Skip to content

Commit 680cd22

Browse files
LeeLenaleeeJacco van den Berg
andauthored
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>
1 parent dd554e0 commit 680cd22

File tree

4 files changed

+52
-0
lines changed

4 files changed

+52
-0
lines changed

src/core/core.datasetController.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -420,6 +420,7 @@ export default class DatasetController {
420420
// if stack changed, update stack values for the whole dataset
421421
if (stackChanged || oldStacked !== meta._stacked) {
422422
updateStacks(this, meta._parsed);
423+
meta._stacked = isStacked(meta.vScale, meta);
423424
}
424425
}
425426

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
module.exports = {
2+
config: {
3+
type: 'line',
4+
data: {
5+
labels: [0, 1, 2, 3, 4, 5, 6],
6+
datasets: [
7+
{
8+
// option in dataset
9+
data: [9, 13, 15, 25, 22, 15, 21],
10+
stack: 'construction_stack',
11+
borderWidth: 10,
12+
borderColor: 'rgb(54, 162, 235)'
13+
},
14+
{
15+
data: [9, 13, 15, 25, 22, 15, 21],
16+
stack: 'construction_stack',
17+
borderWidth: 10,
18+
borderColor: 'rgb(255, 99, 132)'
19+
}
20+
]
21+
},
22+
options: {
23+
scales: {
24+
x: {
25+
ticks: {
26+
display: false
27+
}
28+
},
29+
y: {
30+
ticks: {
31+
display: false
32+
}
33+
}
34+
},
35+
plugins: {
36+
legend: false,
37+
title: false,
38+
tooltip: false,
39+
filler: false
40+
}
41+
}
42+
},
43+
options: {
44+
canvas: {
45+
height: 512,
46+
width: 512
47+
}
48+
}
49+
};
34.6 KB
Loading

test/specs/core.datasetController.tests.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
describe('Chart.DatasetController', function() {
2+
describe('auto', jasmine.fixture.specs('core.datasetController'));
3+
24
it('should listen for dataset data insertions or removals', function() {
35
var data = [0, 1, 2, 3, 4, 5];
46
var chart = acquireChart({

0 commit comments

Comments
 (0)