Context compatibility with dataLabels (#6713)

* Context compatibility with dataLabels

* document

* THe + wording
This commit is contained in:
Jukka Kurkela 2019-11-09 02:59:05 +02:00 committed by Evert Timberg
parent a2bf51a73c
commit 9589953c02
2 changed files with 5 additions and 4 deletions

View File

@ -27,6 +27,7 @@ Chart.js is no longer providing the `Chart.bundle.js` and `Chart.bundle.min.js`.
* `custom` attribute of elements was removed. Please use scriptable options
* The `zeroLine*` options of axes were removed.
* The `hover` property of scriptable options `context` object was renamed to `active` to align it with the datalabels plugin.
### Options

View File

@ -704,7 +704,7 @@ helpers.extend(DatasetController.prototype, {
/**
* @private
*/
_resolveDatasetElementOptions: function(hover) {
_resolveDatasetElementOptions: function(active) {
var me = this;
var chart = me.chart;
var datasetOpts = me._config;
@ -715,15 +715,15 @@ helpers.extend(DatasetController.prototype, {
// Scriptable options
var context = {
chart: chart,
chart,
dataset: me.getDataset(),
datasetIndex: me.index,
hover: hover
active
};
for (i = 0, ilen = elementOptions.length; i < ilen; ++i) {
key = elementOptions[i];
readKey = hover ? 'hover' + key.charAt(0).toUpperCase() + key.slice(1) : key;
readKey = active ? 'hover' + key.charAt(0).toUpperCase() + key.slice(1) : key;
values[key] = resolve([
datasetOpts[readKey],
options[readKey]