mirror of
https://github.com/chartjs/Chart.js.git
synced 2024-10-06 20:29:12 +02:00
e42413f3e8
* Remove unused model properties * Add to migration guide
3.7 KiB
3.7 KiB
Chart.js 3.x Migration Guide
Chart.js 3.0 introduces a number of breaking changes. Chart.js 2.0 was released in April 2016. In the years since then, as Chart.js has grown in popularity and feature set, we've learned some lessons about how to better create a charting library. In order to improve performance, offer new features, and improve maintainability it was necessary to break backwards compatibility, but we aimed to do so only when necessary.
Setup
Chart.js is no longer providing the Chart.bundle.js
and Chart.bundle.min.js
. Please see the installation and integration docs for details on the recommended way to setup Chart.js if you were using these builds.
End user migration
Ticks
options.ticks.userCallback
was renamed tooptions.ticks.callback
Tooltip
xLabel
andyLabel
were removed. Please useindex
andvalue
Interactions
options.onClick
is now limited to the chart area{mode: 'single'}
was replaced with{mode: 'nearest', intersect: true}
{mode: 'label'}
was replaced with{mode: 'index'}
modes['X-axis']
was replaced with{mode: 'index', intersect: false}
Customizability
custom
attribute of elements was removed. Please use scriptable options
Options
- The dataset option
tension
was renamed tolineTension
scales.[x/y]Axes.barPercentage
was moved to dataset optionbarPercentage
scales.[x/y]Axes.barThickness
was moved to dataset optionbarThickness
scales.[x/y]Axes.categoryPercentage
was moved to dataset optioncategoryPercentage
scales.[x/y]Axes.minBarLength
was moved to dataset optionminBarLength
scales.[x/y]Axes.maxBarThickness
was moved to dataset optionmaxBarThickness
scales.[x/y]Axes.time.format
was renamed toscales.[x/y]Axes.time.parser
scales.[x/y]Axes.time.min
was renamed toscales.[x/y]Axes.ticks.min
scales.[x/y]Axes.time.max
was renamed toscales.[x/y]Axes.ticks.max
Developer migration
Removed
afterScaleUpdate
helpers.addEvent
helpers.aliasPixel
helpers.configMerge
helpers.indexOf
helpers.min
helpers.max
helpers.numberOfLabelLines
helpers.removeEvent
helpers.scaleMerge
Scale.getRightValue
Scale.mergeTicksOptions
Scale.ticksAsNumbers
Chart.Controller
Chart.chart.chart
Chart.types
Line.calculatePointY
Element.getArea
Element.height
Element.inLabelRange
- Made
scale.handleDirectionalChanges
private - Made
scale.tickValues
private
Removal of private APIs
_model.datasetLabel
_model.label
Renamed
helpers.clear
was renamed tohelpers.canvas.clear
helpers.drawRoundedRectangle
was renamed tohelpers.canvas.roundedRect
helpers.callCallback
was renamed tohelpers.callback
helpers.getValueOrDefault
was renamed tohelpers.valueOrDefault
helpers.getValueAtIndexOrDefault
was renamed tohelpers.valueAtIndexOrDefault
helpers.easingEffects
was renamed tohelpers.easing.effects
helpers.log10
was renamed tohelpers.math.log10
Chart.Animation.animationObject
was renamed toChart.Animation
Chart.Animation.chartInstance
was renamed toChart.Animation.chart
Changed
Scales
scale.getLabelForIndex
was replaced byscale.getLabelForValue
scale.getPixelForValue
now has only one parameter
Ticks
scale.ticks
now contains objects instead of stringsbuildTicks
is now expected to return tick objectsafterBuildTicks
now has no parameters like the other callbacksconvertTicksToLabels
was renamed togenerateTickLabels
. It is now expected to set the label property on the ticks given as input
Time Scale
getValueForPixel
now returns milliseconds since the epoch