Simon Brunel [Tue, 6 Sep 2016 09:10:44 +0000 (11:10 +0200)]
Auto-release charts if not persistent (tests)
For convenience, charts are now automatically released after each spec if they are not acquired using `persistent: true`. Also remove the confusing and error prone `chartInstance` global variable and make sure that chart instances are local to each spec.
Fix 3267 Add "onHover" functionality for legend (#3271)
Add "onHover" to the legend options that will hold a user defined function (default is null) and called when a "mousemove" event is registered on top of a label item, with same parameters as the "onClick" option.
Also introduced logic that determines if the type of event passed to the legend "handleEvent" function is one we can handle. Currently allowing "click" and "mousemove" events. If the event is not one of those we stop the function execution (this is for the sake of reusing the legend hitbox calculations).
Ian Ker-Seymer [Fri, 2 Sep 2016 20:39:25 +0000 (16:39 -0400)]
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:
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.
Simon Brunel [Fri, 2 Sep 2016 19:56:22 +0000 (21:56 +0200)]
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`.
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.
Simon Brunel [Sun, 28 Aug 2016 13:53:34 +0000 (15:53 +0200)]
Remove encrypted data from .travis.yml
Secure values are now read from environment variables defined in the repository settings: https://docs.travis-ci.com/user/environment-variables/#Defining-Variables-in-Repository-Settings
Simon Brunel [Sun, 28 Aug 2016 10:18:18 +0000 (12:18 +0200)]
#3033 Deploy dist files and bower.json (tags)
Add a new Travis deploy task to push dist/*.js and bower.json files into tag sources:
- requires Travis GITHUB_AUTH_TOKEN and GITHUB_AUTH_EMAIL environment variables
- skipped if not built from the "release" branch
- release.sh must be executable (see comment)
- reads tag version from package.json
- fails if tag already exists
Tomasz Moń [Mon, 22 Aug 2016 18:50:48 +0000 (21:50 +0300)]
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.
MatthieuRivaud [Mon, 8 Aug 2016 13:35:46 +0000 (15:35 +0200)]
- Added dataset option |cubicInterpolationMode| to allow for curves with different interpolation modes on the same graph (updated doc accordingly)
- Added new sample file to demonstrate the monotone cubic interpolation mode
- Fixed a typo in a comment in updateBezierControlPoints
Ian Ker-Seymer [Tue, 26 Jul 2016 18:45:05 +0000 (14:45 -0400)]
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.
Refactoring of the line drawing function to make `spanGaps` work correctly. Added a lot more test conditions to the line element tests. Ensured that the line controller correctly calculated bezier control points when there was a point to be skipped