Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix initial dataset stacks #11882

Merged
merged 2 commits into from
Aug 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/core/core.datasetController.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}

Expand Down
49 changes: 49 additions & 0 deletions test/fixtures/core.datasetController/stacked-initial-render.js
Original file line number Diff line number Diff line change
@@ -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
}
}
};
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 2 additions & 0 deletions test/specs/core.datasetController.tests.js
Original file line number Diff line number Diff line change
@@ -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({
Expand Down
Loading