Commit Graph

230 Commits

Author SHA1 Message Date
Josh Soref
67934920be Spelling fixes (#3522)
Including: actually, aspect, bottom, changes, characters, datasets, divisible, downward, guidelines, instance, instances, interrupted, item, javascript, label, lifecycle, lines, plugins, manually, milliseconds, nearest, occurring, position, predefined, recalculate, tooltip, those
2016-10-27 21:18:31 +02:00
Evert Timberg
d09a17a2b1 Better number -> string callback for the radial linear scale (#3281)
Also create a new Chart.Ticks namespace to host common tick generators and formatters.
2016-09-24 22:56:16 +02:00
Zach Panzarino
bddd4cd94b Fix style issues in core and scales 2016-09-15 00:23:30 +00:00
Zach Panzarino
dd8fa78b45 Fix more style errors in controllers, elements, and scales 2016-09-14 22:34:41 +00:00
Zach Panzarino
11739234a4 Add keyword spacing to eslint and update code 2016-09-14 18:12:23 +00:00
Zach Panzarino
2d2f475a7a First round of eslint fixes 2016-09-14 18:05:19 +00:00
Evert Timberg
d8b13ca4ab Merge pull request #3261 from desowin/3211
Implement moment diff cache in time scale
2016-09-12 19:37:50 -04:00
Tomasz Moń
0514ed4793 Fix check for undefined
Use '!==' instead of '!='. This fixes eqeqeq error reported by gulp-eslint.
2016-09-12 10:41:27 +03:00
Evert Timberg
eb5bca6a4a When the category scale is used as the non main scale, return the correct data for the tooltip 2016-09-09 21:03:59 -04:00
Simon Brunel
52cdff5fc1 Merge pull request #3254 from ianks/minDisplayFormat
Suport minUnit for time scale
2016-09-08 13:34:53 +02:00
Ian Ker-Seymer
7af6e7f192
Suport minUnit for time scale
When dealing with time-delineated datasets, often we have data for known
intervals of time. For example, we may have a dataset which represents number
of purchases per day:

```json
{
	labels: ['2016-01-01', '2016-01-02', '2016-01-03']
	datasets: [
		{
			data: [12, 87, 42]
		}
	],
	'...': '...'
}
```

In this case, Chart.js will attempt to figure out the best interval to display
the data, and could pick `hours` as the unit. However, in this case, we would
prefer to just use the `days` interval since our data's granularity can not be
represented well with `hours`.

To remedy this, this commit adds the `minUnit` option which allows
users to (optionally) specify what the minimum unit they would like
to use.
2016-09-06 13:11:06 -04:00
Tomasz Moń
cd24895cd1 Build labelDiffs cache once per update (#3211)
Previously buildLabelDiffs() was called at the end of buildTicks() and
hence labelDiffs cache was calculated twice (in getMinimumBoxSize() and
then in fitBox()).
2016-09-04 10:22:27 +03:00
Tomasz Moń
020ac35852 Build label diff lookup table
This reduces number of calls to momentjs diff() if there are multiple
datasets sharing the same labels (#3211).
2016-09-03 22:30:05 +03:00
Simon Brunel
3d40774c7d Enforce consistent tab indentation
indent: [error, tab] (http://eslint.org/docs/rules/indent)
2016-09-03 18:42:26 +02:00
Simon Brunel
69ab0d3e23 Use gulp-eslint instead of gulp-jshint
Change the linter in gulp tasks to be consistent with Code Climate results which are based on ESLint using .eslintrc options. However, defaults Code Climate rules are too strict, so turn as warnings the 'complexity' and 'max-statements' rules (other errors has been fixed). Note that the Gulp task name has been changed for `gulp lint`.
2016-09-03 18:42:22 +02:00
courchef
6269e2c437 Error possible when using the plugin Chart.Zoom.js used with time scale (#3194)
Zooming in can cause the params `datasetIndex` and `index` to be null in method `getLabelMoment`. This happens when no ticks are visible on scale. It also throws an error and the chart becomes broken.
2016-09-03 18:06:09 +02:00
Ekaterina Dontsova
4a4dccd6c1 Fix #3044 Line chart single data point centering (#3166)
In line charts, when there is only one label and data point, both are now horizontally centered.
2016-08-25 18:52:12 +02:00
Evert Timberg
1749d90faf Fix issues with repeated labels in the category scale and added a test to cover this case. 2016-08-22 18:03:56 -04:00
Evert Timberg
b33aff2091 Merge pull request #3131 from Lighnat0r/master
Use parser options in getPixelForValue for time scale
2016-08-22 17:53:55 -04:00
Tomasz Moń
c283867f73 Remove smallestLabelSeparation from TimeScale (#3186)
In case of charts with over 4000 points, smallestLabelSeparation
calculation contributes significantly to total cpu usage (about 25% according
to built-in Chrome profiler). Important thing to note is that result
of this calculation is not used at all.

Related commits:
  * 677c249b61
    introduced smallestLabelSeparation. It was used in calculateBaseWidth
    function.
  * d198157fb8
    removed last use of smallestLabelSeparation. Since then the calculated
    value was never used.
2016-08-22 14:50:48 -04:00
Ekaterina Dontsova
31197978b7 Fix #2966: 0 values in logarithmic scale for line and vertical bar charts (#3016) 2016-08-11 21:40:25 +02:00
Lighnat0r
ff0e8eadab Use parser options in getPixelForValue for time scale 2016-08-10 19:14:02 +02:00
Zach Panzarino
abfbdd5f31 Remove unneeded trailing commas 2016-08-10 01:35:34 +00:00
Evert Timberg
b86e42f2ae Fix JS Hint warning 2016-07-30 11:33:59 -04:00
Evert Timberg
0bb2e478db Recalculate the size of the scale in units when the end point is changed. 2016-07-30 11:06:13 -04:00
Ian Ker-Seymer
e4dd158b24
Fix out of bounds index access in getLabelMoment
Previously, calling getLabelMoment with an out of bound index would cause an
error such as this:

```
Uncaught TypeError: Cannot read property 'null' of undefined
```

This happens because there is not always guaranteed to be a labelMoment on
at the current datasetIndex.

One example of this is practice comes from a this function call:

```js
// since the are not always guaranteed to be at least two labelMoments
//                                \ / this index can be out of bounds
//                                 |
var tickWidth = me.getPixelForTick(1) - me.getPixelForTick(0) - 6;
```

This patch simply ensures that the `labelMoments` for the `datasetIndex` are
defined before accessing properties on it.
2016-07-26 14:45:05 -04:00
unknown
1a63113bc0 changed option name for radar chart from offsetAngle to startAngle. Added test to make sure correct angles are computed for all points in the radar chart (with and without startAngle option set). 2016-07-17 23:11:30 -06:00
unknown
d7733b2221 Merge remote-tracking branch 'chartjs-origin/master' 2016-07-16 18:59:22 -06:00
unknown
ad7ed249af Add an option for radar chart to have offsetAngle. Issue #1012 2016-07-16 18:58:04 -06:00
Evert Timberg
3dd15f64d2 Merge pull request #2918 from chartjs/fix/2916
Fix time point lines. Improved logic for using the value in the time …
2016-07-13 18:21:57 -04:00
Evert Timberg
b6686f00f4 Non numeric y (#2849)
* Category scale can now read from the xLabels and yLabels properties.

* Update docs with section regarding the data object.

* Add sample file with non numeric Y and fix animations
2016-07-09 09:22:25 -06:00
Evert Timberg
758698c354 Fix time point lines. Improved logic for using the value in the time scale. Improve value passing in the line and bubble controllers/ 2016-07-05 20:52:17 -04:00
Evert Timberg
3660d9be39 Consider left and top when determining value from pixel in category scale 2016-06-29 07:00:09 -04:00
William Entriken
f2270ed8db Merge pull request #2741 from duerahan/master
time type xAxis height crah in line chart #2622
2016-06-27 13:59:41 -04:00
Evert Timberg
48ac791a0c Allow passing a value to the time scale getPixelForValue method 2016-06-21 19:03:30 -04:00
Simon Brunel
47912f49b4 Remove duplicated function names 2016-06-18 11:15:25 +02:00
Simon Brunel
f36123925c Fix #2734 Cleanup unused variables 2016-06-18 11:00:11 +02:00
Evert Timberg
e7834442ac Merge pull request #2739 from msimulcik/master
Fix of radial linear scale font family settings bug
2016-06-09 18:36:26 -04:00
Jack Valuntine
7d63bf085a time type xAxis height crah in line chart
if input only one data in dataset and xAxis type is date make offset crash.
check offset value and don't devide 0 value.
Add xAxis check test case.
2016-06-09 13:34:15 +09:00
Miroslav Simulcik
6e3c6c05ad Fixed radial linear scale font family settings bug 2016-06-08 15:21:54 +02:00
Evert Timberg
a687749ed4 Radial linear scale array properties for line width and color 2016-06-07 20:09:33 -04:00
zachpanz88
5fae4dd305 Change this -> me in source files
This change allows for smaller minified code in the final version, resulting in a smaller file size. Some files had previously used _this, but that has been changed to me to keep consistency throughout the project.
2016-06-04 14:14:16 -04:00
Evert Timberg
3cd21c8053 Linear and RadialLinear scales now derive from a common base class 2016-05-29 10:16:47 -04:00
Simon Brunel
a566d16e69 Refactor scale base pixel and point calculation. 2016-05-20 20:17:28 +02:00
Blake Niemyjski
7e85245e4f Fixed unit tests :D 2016-05-13 22:39:11 -05:00
Blake Niemyjski
bea68f1424 Performance and minification improvements 2016-05-13 22:07:39 -05:00
Evert Timberg
f34453cf8f Error when first data point on time scale had null data 2016-05-13 19:50:59 -04:00
Evert Timberg
14021069c3 Merge branch 'master' into file-size-reduction
Conflicts:
	src/controllers/controller.doughnut.js
	src/controllers/controller.polarArea.js
2016-05-12 18:57:22 -04:00
Tom Duncalf
8b3d079a50 Add isoWeekday option to allow time scale ticks in 'week' unit mode to start on a specified day of the week 2016-05-11 09:44:02 +01:00
Evert Timberg
ebffa52dc2 allow callback or userCallback in the time scale 2016-05-09 17:14:25 -05:00