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 * `custom` attribute of elements was removed. Please use scriptable options
* The `zeroLine*` options of axes were removed. * 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 ### Options

View File

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