Options may be configured directly on the dataset. The dataset options can be changed at 3 different levels and are evaluated with the following priority:
- per dataset: dataset.*
-- per chart: options[type].datasets.*
+- per chart: options.datasets[type].*
- or globally: Chart.defaults.controllers[type].datasets.*
where type corresponds to the dataset type.
* `scales.[x/y]Axes.zeroLine*` options of axes were removed. Use scriptable scale options instead.
* The dataset option `steppedLine` was removed. Use `stepped`
* The chart option `showLines` was renamed to `showLine` to match the dataset option.
-* Dataset options are now configured as `options[type].datasets` rather than `options.datasets[type]`
* To override the platform class used in a chart instance, pass `platform: PlatformClass` in the config object. Note that the class should be passed, not an instance of the class.
* `aspectRatio` defaults to 1 for doughnut, pie, polarArea, and radar charts
* `TimeScale` does not read `t` from object data by default anymore. The default property is `x` or `y`, depending on the orientation. See [data structures](../general/data-structures.md) for details on how to change the default.
export function getIndexAxis(type, options) {
const typeDefaults = defaults.controllers[type] || {};
const datasetDefaults = typeDefaults.datasets || {};
- const typeOptions = options[type] || {};
- const datasetOptions = typeOptions.datasets || {};
- return datasetOptions.indexAxis || options.indexAxis || datasetDefaults.indexAxis || 'x';
+ const datasetOptions = options.datasets || {};
+ const typeOptions = datasetOptions[type] || {};
+ return typeOptions.indexAxis || options.indexAxis || datasetDefaults.indexAxis || 'x';
}
function getAxisFromDefaultScaleID(id, indexAxis) {
const me = this;
me._config = merge(Object.create(null), [
defaults.controllers[me._type].datasets,
- (me.chart.options[me._type] || {}).datasets,
+ (me.chart.options.datasets || {})[me._type],
me.getDataset(),
], {
merger(key, target, source) {
},
"options": {
"responsive": false,
- "bar": {
- "datasets": {
+ "datasets": {
+ "bar": {
"barPercentage": 1,
"categoryPercentage": 1
}
},
"options": {
"responsive": false,
- "bar": {
- "datasets": {
+ "datasets": {
+ "bar": {
"barPercentage": 1,
"categoryPercentage": 1
}
},
"options": {
"responsive": false,
- "bar": {
- "datasets": {
+ "datasets": {
+ "bar": {
"barPercentage": 1,
"categoryPercentage": 1
}
},
"options": {
"responsive": false,
- "bar": {
- "datasets": {
+ "datasets": {
+ "bar": {
"barPercentage": 1,
"categoryPercentage": 1
}
},
"options": {
"responsive": false,
- "bar": {
- "datasets": {
+ "datasets": {
+ "bar": {
"barPercentage": 1,
"categoryPercentage": 1
}
labels: ['label1', 'label2', 'label3', 'label4']
},
options: {
- bar: {
- datasets: {
+ datasets: {
+ bar: {
barPercentage: 1,
}
},
labels: ['label1', 'label2', 'label3', 'label4']
},
options: {
- bar: {
- datasets: {
+ datasets: {
+ bar: {
barPercentage: 1,
}
},
options: {
animation: false,
responsive: false,
- line: {
- datasets: {
+ datasets: {
+ line: {
tension: 0.4,
borderWidth: 1,
pointRadius: 1.5,
options: {
legend: false,
title: false,
- bar: {
- datasets: {
+ datasets: {
+ bar: {
barThickness: barThickness
}
},
labels: ['label1', 'label2']
},
options: {
- line: {
- datasets: {
+ datasets: {
+ line: {
tension: 0.345,
backgroundColor: '#add'
}
labels: ['label1', 'label2']
},
options: {
- line: {
- datasets: {
+ datasets: {
+ line: {
spanGaps: true,
tension: 0.231,
backgroundColor: '#add',