mirror of
https://github.com/chartjs/Chart.js.git
synced 2024-10-05 19:59:07 +02:00
Fix initial dataset stacks (#11882)
* Update cahced _stacked value after updating stacks * Add test --------- Co-authored-by: Jacco van den Berg <jacco@jem-id.nl>
This commit is contained in:
parent
dd554e0d87
commit
680cd227d4
@ -420,6 +420,7 @@ export default class DatasetController {
|
||||
// if stack changed, update stack values for the whole dataset
|
||||
if (stackChanged || oldStacked !== meta._stacked) {
|
||||
updateStacks(this, meta._parsed);
|
||||
meta._stacked = isStacked(meta.vScale, meta);
|
||||
}
|
||||
}
|
||||
|
||||
|
49
test/fixtures/core.datasetController/stacked-initial-render.js
vendored
Normal file
49
test/fixtures/core.datasetController/stacked-initial-render.js
vendored
Normal file
@ -0,0 +1,49 @@
|
||||
module.exports = {
|
||||
config: {
|
||||
type: 'line',
|
||||
data: {
|
||||
labels: [0, 1, 2, 3, 4, 5, 6],
|
||||
datasets: [
|
||||
{
|
||||
// option in dataset
|
||||
data: [9, 13, 15, 25, 22, 15, 21],
|
||||
stack: 'construction_stack',
|
||||
borderWidth: 10,
|
||||
borderColor: 'rgb(54, 162, 235)'
|
||||
},
|
||||
{
|
||||
data: [9, 13, 15, 25, 22, 15, 21],
|
||||
stack: 'construction_stack',
|
||||
borderWidth: 10,
|
||||
borderColor: 'rgb(255, 99, 132)'
|
||||
}
|
||||
]
|
||||
},
|
||||
options: {
|
||||
scales: {
|
||||
x: {
|
||||
ticks: {
|
||||
display: false
|
||||
}
|
||||
},
|
||||
y: {
|
||||
ticks: {
|
||||
display: false
|
||||
}
|
||||
}
|
||||
},
|
||||
plugins: {
|
||||
legend: false,
|
||||
title: false,
|
||||
tooltip: false,
|
||||
filler: false
|
||||
}
|
||||
}
|
||||
},
|
||||
options: {
|
||||
canvas: {
|
||||
height: 512,
|
||||
width: 512
|
||||
}
|
||||
}
|
||||
};
|
BIN
test/fixtures/core.datasetController/stacked-initial-render.png
vendored
Normal file
BIN
test/fixtures/core.datasetController/stacked-initial-render.png
vendored
Normal file
Binary file not shown.
After Width: | Height: | Size: 35 KiB |
@ -1,4 +1,6 @@
|
||||
describe('Chart.DatasetController', function() {
|
||||
describe('auto', jasmine.fixture.specs('core.datasetController'));
|
||||
|
||||
it('should listen for dataset data insertions or removals', function() {
|
||||
var data = [0, 1, 2, 3, 4, 5];
|
||||
var chart = acquireChart({
|
||||
|
Loading…
Reference in New Issue
Block a user