From: Evert Timberg Date: Sun, 7 Jun 2020 20:32:08 +0000 (-0400) Subject: Stacked scatter chart (#7468) X-Git-Tag: v3.0.0-beta.2~106 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6f14b145d1e1ac3a9e30c37543a72c7d4ac4bbff;p=thirdparty%2FChart.js.git Stacked scatter chart (#7468) * Handle partially stacked scatter charts * Update test files --- diff --git a/src/core/core.datasetController.js b/src/core/core.datasetController.js index 478f77360..a5626b899 100644 --- a/src/core/core.datasetController.js +++ b/src/core/core.datasetController.js @@ -638,8 +638,9 @@ export default class DatasetController { let i, value, parsed, otherValue; function _compute() { - if (stack) { - stack.values = parsed._stacks[scale.axis]; + const values = stack && parsed._stacks[scale.axis]; + if (stack && values) { + stack.values = values; // Need to consider individual stack values for data range, // in addition to the stacked value min = Math.min(min, value); diff --git a/test/fixtures/controller.line/stacking/stacked-scatter.js b/test/fixtures/controller.line/stacking/stacked-scatter.js new file mode 100644 index 000000000..7fa6032dd --- /dev/null +++ b/test/fixtures/controller.line/stacking/stacked-scatter.js @@ -0,0 +1,68 @@ +module.exports = { + config: { + type: 'scatter', + data: { + datasets: [{ + label: 'label1', + data: [{ + x: 0, + y: 30 + }, { + x: 5, + y: 35 + }, { + x: 10, + y: 20 + }], + backgroundColor: '#42A8E4' + }, + { + label: 'label2', + data: [{ + x: 0, + y: 10 + }, { + x: 5, + y: 15 + }, { + x: 10, + y: 15 + }], + backgroundColor: '#FC3F55' + }, + { + label: 'label3', + data: [{ + x: 0, + y: -15 + }, { + x: 5, + y: -10 + }, { + x: 10, + y: -20 + }], + backgroundColor: '#FFBE3F' + }], + }, + options: { + scales: { + x: { + display: false, + position: 'bottom', + }, + y: { + stacked: true, + display: false, + position: 'left', + }, + }, + }, + }, + options: { + canvas: { + height: 256, + width: 512 + } + } +}; diff --git a/test/fixtures/controller.line/stacking/stacked-scatter.png b/test/fixtures/controller.line/stacking/stacked-scatter.png new file mode 100644 index 000000000..cfe32c745 Binary files /dev/null and b/test/fixtures/controller.line/stacking/stacked-scatter.png differ