CanvasRenderingContext2D.fillText() accepts a fourth parameter called maxWidth that sets the maximum width of the drawn text, enforced by scaling the entire line.
This commit uses the title element's layout dimensions to set maxWidth and avoid overflow outside of the canvas.
Simon Brunel [Fri, 23 Sep 2016 15:46:17 +0000 (17:46 +0200)]
Make charts vertically responsive (#3105) (#3326)
Ensure that the hidden iframe is stretched vertically in order to detect height changes. Remove the classlist check/call since it was incorrectly spelled (should be classList), but also useless since the iframe has just been generated. Also remove the callback check: addResizeListener should never be called w/o a valid callback.
Simon Brunel [Sat, 17 Sep 2016 09:24:31 +0000 (11:24 +0200)]
Change bower package name for chart.js (#1562)
Thanks to the Bower team, we have been able to register the chart.js package name, previously pointing on a dead repository, which make the Bower integration more consistent with the npm one. All other alias still work (Chart.js, chartjs, Chart-js, chartjs-Chart.js).
Fix bug with pie/doughnut chart legends
Fixes a rendering issue when there are multiple datasets on a pie chart and they do not all contain the same number of data in their datasets
Fixes #3309
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.
Tomasz Moń [Sun, 4 Sep 2016 07:22:27 +0000 (10:22 +0300)]
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()).
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