mirror of
https://github.com/chartjs/Chart.js.git
synced 2026-03-07 00:36:50 +01:00
Fix toggling showLine option on scatter controller (#11334)
This commit is contained in:
@@ -70,6 +70,10 @@ export default class ScatterController extends DatasetController {
|
||||
|
||||
if (this.options.showLine) {
|
||||
|
||||
// https://github.com/chartjs/Chart.js/issues/11333
|
||||
if (!this.datasetElementType) {
|
||||
this.addElements();
|
||||
}
|
||||
const {dataset: line, _dataset} = meta;
|
||||
|
||||
// Update Line
|
||||
@@ -84,6 +88,10 @@ export default class ScatterController extends DatasetController {
|
||||
animated: !animationsDisabled,
|
||||
options
|
||||
}, mode);
|
||||
} else if (this.datasetElementType) {
|
||||
// https://github.com/chartjs/Chart.js/issues/11333
|
||||
delete meta.dataset;
|
||||
this.datasetElementType = false;
|
||||
}
|
||||
|
||||
// Update Points
|
||||
|
||||
34
test/fixtures/controller.scatter/showLine/changed.js
vendored
Normal file
34
test/fixtures/controller.scatter/showLine/changed.js
vendored
Normal file
@@ -0,0 +1,34 @@
|
||||
module.exports = {
|
||||
description: 'showLine option should draw a line if true',
|
||||
config: {
|
||||
type: 'scatter',
|
||||
data: {
|
||||
datasets: [{
|
||||
data: [{x: 10, y: 15}, {x: 15, y: 10}],
|
||||
pointRadius: 10,
|
||||
backgroundColor: 'red',
|
||||
label: 'dataset1'
|
||||
}],
|
||||
},
|
||||
options: {
|
||||
scales: {
|
||||
x: {
|
||||
display: false
|
||||
},
|
||||
y: {
|
||||
display: false
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
options: {
|
||||
canvas: {
|
||||
width: 256,
|
||||
height: 256
|
||||
},
|
||||
run(chart) {
|
||||
chart.options.showLine = true;
|
||||
chart.update();
|
||||
}
|
||||
}
|
||||
};
|
||||
BIN
test/fixtures/controller.scatter/showLine/changed.png
vendored
Normal file
BIN
test/fixtures/controller.scatter/showLine/changed.png
vendored
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 3.8 KiB |
Reference in New Issue
Block a user