Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: chartjs/Chart.js
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v4.4.5
Choose a base ref
...
head repository: chartjs/Chart.js
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 47245a7f36ea581ff996f454b72859437715b2a8
Choose a head ref
  • 3 commits
  • 4 files changed
  • 4 contributors

Commits on Oct 15, 2024

  1. Fix 404 to samples in release drafter (#11933)

    Co-authored-by: Jacco van den Berg <jacco@jem-id.nl>
    LeeLenaleee and Jacco van den Berg authored Oct 15, 2024
    Copy the full SHA
    bb5ca38 View commit details

Commits on Oct 24, 2024

  1. Fix: applyStack() returned the sum of all values for hidden dataset i…

    …ndices, which resulted in wrong show animations (#11938)
    DeyLak authored Oct 24, 2024
    Copy the full SHA
    6dd448b View commit details

Commits on Oct 28, 2024

  1. chore: version bump for 4.4.6 release (#11943)

    etimberg authored Oct 28, 2024
    Copy the full SHA
    47245a7 View commit details
Showing with 52 additions and 2 deletions.
  1. +1 −1 .github/release-drafter.yml
  2. +1 −1 package.json
  3. +7 −0 src/core/core.datasetController.js
  4. +43 −0 test/specs/controller.bar.tests.js
2 changes: 1 addition & 1 deletion .github/release-drafter.yml
Original file line number Diff line number Diff line change
@@ -47,7 +47,7 @@ template: |
* [Migration guide](https://www.chartjs.org/docs/$RESOLVED_VERSION/migration/v4-migration.html)
* [Docs](https://www.chartjs.org/docs/$RESOLVED_VERSION/)
* [API](https://www.chartjs.org/docs/$RESOLVED_VERSION/api/)
* [Samples](https://www.chartjs.org/docs/$RESOLVED_VERSION/samples/)
* [Samples](https://www.chartjs.org/docs/$RESOLVED_VERSION/samples/information.html)
$CHANGES
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -2,7 +2,7 @@
"name": "chart.js",
"homepage": "https://www.chartjs.org",
"description": "Simple HTML5 charts using the canvas element.",
"version": "4.4.5",
"version": "4.4.6",
"license": "MIT",
"type": "module",
"sideEffects": [
7 changes: 7 additions & 0 deletions src/core/core.datasetController.js
Original file line number Diff line number Diff line change
@@ -76,9 +76,11 @@ function applyStack(stack, value, dsIndex, options = {}) {
return;
}

let found = false;
for (i = 0, ilen = keys.length; i < ilen; ++i) {
datasetIndex = +keys[i];
if (datasetIndex === dsIndex) {
found = true;
if (options.all) {
continue;
}
@@ -89,6 +91,11 @@ function applyStack(stack, value, dsIndex, options = {}) {
value += otherValue;
}
}

if (!found && !options.all) {
return 0;
}

return value;
}

43 changes: 43 additions & 0 deletions test/specs/controller.bar.tests.js
Original file line number Diff line number Diff line change
@@ -1613,6 +1613,49 @@ describe('Chart.controllers.bar', function() {
expect(data[0].y).toBeCloseToPixel(512);
});

it('should hide bar dataset beneath the chart for correct animations', function() {
var chart = window.acquireChart({
type: 'bar',
data: {
datasets: [{
data: [1, 2, 3, 4]
}, {
data: [1, 2, 3, 4]
}],
labels: ['A', 'B', 'C', 'D']
},
options: {
plugins: {
legend: false,
title: false
},
scales: {
x: {
type: 'category',
display: false,
stacked: true,
},
y: {
type: 'linear',
display: false,
stacked: true,
}
}
}
});

var data = chart.getDatasetMeta(0).data;
expect(data[0].base).toBeCloseToPixel(512);
expect(data[0].y).toBeCloseToPixel(448);

chart.setDatasetVisibility(0, false);
chart.update();

data = chart.getDatasetMeta(0).data;
expect(data[0].base).toBeCloseToPixel(640);
expect(data[0].y).toBeCloseToPixel(512);
});

describe('Float bar', function() {
it('Should return correct values from getMinMax', function() {
var chart = window.acquireChart({