MDL-80351 libraries: ChartJS axis options being ignored
When chartJs was updated to version 3.8.0, chart axis were now accessed as a object property instead of an array element. This solution aims to update the way we set the axis properties, aiming to display the labels and other properties.
This commit is contained in:
+1
-1
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -226,11 +226,10 @@ define([
|
||||
var axisLabels = axis.getLabels();
|
||||
|
||||
config.options.scales = config.options.scales || {};
|
||||
config.options.scales.x = config.options.scales.x || {};
|
||||
config.options.scales.x[i] = this._makeAxisConfig(axis, 'x', i);
|
||||
config.options.scales.x = this._makeAxisConfig(axis, 'x', i);
|
||||
|
||||
if (axisLabels !== null) {
|
||||
config.options.scales.x[i].ticks.callback = function(value, index) {
|
||||
config.options.scales.x.ticks.callback = function(value, index) {
|
||||
return axisLabels[index] || '';
|
||||
};
|
||||
}
|
||||
@@ -241,11 +240,10 @@ define([
|
||||
var axisLabels = axis.getLabels();
|
||||
|
||||
config.options.scales = config.options.scales || {};
|
||||
config.options.scales.y = config.options.scales.yAxes || {};
|
||||
config.options.scales.y[i] = this._makeAxisConfig(axis, 'y', i);
|
||||
config.options.scales.y = this._makeAxisConfig(axis, 'y', i);
|
||||
|
||||
if (axisLabels !== null) {
|
||||
config.options.scales.y[i].ticks.callback = function(value) {
|
||||
config.options.scales.y.ticks.callback = function(value) {
|
||||
return axisLabels[parseInt(value, 10)] || '';
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user