Version 2.5.0
Version 2.5 brings some exciting new features to Chart.js. Now, configuration options can be updated at runtime (with some exceptions) just by changing the chart.config.options
object and calling chart.update()
.
More powerful plugins that can be added to an individual chart (instead of globally), but also disabled on a per chart basis. This gives you fine grained control over when plugins interact with your charts. The plugins were changed to support cancelling actions by returning false
from any before*
plugin calls.
Two new extensions have been added: beforeEvent
and afterEvent
, respectively called before and after the chart responds to an input event such as a mousemove
or a click
. The plugin is passed a wrapped version of the event, that implements IEvent
.
Breaking Changes
- #3570 Removed unused
Chart.helpers.cancelAnimFrame
method. - #3669
onHover
callback now has 3 parameters. The 2nd parameter is the event that triggered the hover. This was done for consistency with theonClick
callback.
Deprecations
- #3819
IPlugin.afterScaleUpdate
: useIPlugin.afterLayout
hook instead. - #3819 Extending
Chart.PlugingBase
is not anymore required and is strongly discouraged, instead create/register plugins using plain JavaScript objects (see this example).
New Features
- #2060 Chart options can now be updated at runtime.
- #2643 Stacked bar charts now support groupings into smaller stacks. Thanks @potatopeelings
- #3335 Plugins can now be specified per chart.
Enhancements
- #1933 Legends can now be hidden dynamically by a plugin at runtime based on the chart size.
- #2873, #3491, #3506 Chart elements are clipped when outside the chart area. Thanks @KoyoSE
- #3208 Slow performance using moment.js. Thanks @tredston
- #3225 Multiple lines of text are now supported in radar chart labels
- #3514 Add
rectRounded
point style. Thanks @cmoel - #3818 Removed useless initialization steps to improve performance
Issues Fixed
- #2478 Large x axis labels created odd gaps in the chart
- #2780 Bar chart when data is 0. Thanks @KoyoSE
- #2879, #3354 Rotated labels caused issues on the category axis
- #3141 Axis width incorrectly used
ticks.padding
option when measuring - #3199 Line Chart border width of 0 was ignored.
- #3412 Long y axis tick text was cutoff
- #3381 Infinite loop when in certain cases when generating logarithmic ticks.
- #3387 Fixed legend text alignment
- #3408 Monotone cubic interpolation broke when two adjacent points had the same x value
- #3528
null
data caused incorrect tooltips for the time scale. Thanks @Jareechang - #3585 Logarithmic stacked bar charts don't draw the first dataset
- #3589 Wrong category size of bars when x axis has min and max options. Thanks @KoyoSE
- #3591 Correct radar chart tension settings
- #3592 Correct radar chart documentation name for point radius setting
- #3603 Fix crash in
dataset
interaction mode - #3605 Documentation for
x-axis
interaction mode was incorrect. Thanks @weareoutman - #3607 Correct link in animation section of documentation. Thanks @38elements
- #3618 Tooltip label is incorrect on Bar chart when min is defined. Thanks @KoyoSE
- #3685 bug when calculating if steps fit into scale as a whole number. Thanks @Tarqwyn
- #3713 Axis label was cutoff when axis was at top of chart. Thanks @KoyoSE
- #3717 Removed jQuery code from samples. Thanks @KoyoSE
- #3739 Incorrect use of animation options in doughnut chart docs. Thanks @NtsDK
- #3741 Axis labels placed incorrectly when axis is at the top of the chart. Thanks @KoyoSE
- #3763 Pie charts incorrectly calculated the inner radius when cutout percentage was 0.
- #3772 Fix incorrect anchor link in docs. Thanks @mdewilde
- #3788 Fixed docs for using Chart.js with CommonJS and ES6 imports. Thanks @Jareechang
- #3801 Ignore
.gitignore
file for Bower
Development
- #3610 Updated documentation for plugin renames. Thanks @compwright
- #3635 Upgrade to
gulp-uglify
v2.0.0 to improve build speed. Thanks @jeffcarey - #3718, #3795 Refactoring to move platform specific code into it's own module. The ultimate goal is to allow builds for non browser platforms
More details in the release PR: #3840