From 7cbc47beccc260e65e7d8de20ba86e37f597b446 Mon Sep 17 00:00:00 2001 From: Evert Timberg Date: Sun, 28 Nov 2021 10:25:27 -0500 Subject: [PATCH] Chart area boxes receive 0 margin during the final layout process (#9915) --- src/core/core.layouts.js | 2 +- .../plugin.legend/legend-line-chart-area.json | 35 ++++++++++++++++++ .../plugin.legend/legend-line-chart-area.png | Bin 0 -> 3665 bytes 3 files changed, 36 insertions(+), 1 deletion(-) create mode 100644 test/fixtures/plugin.legend/legend-line-chart-area.json create mode 100644 test/fixtures/plugin.legend/legend-line-chart-area.png diff --git a/src/core/core.layouts.js b/src/core/core.layouts.js index c5c7e4674..5154e1285 100644 --- a/src/core/core.layouts.js +++ b/src/core/core.layouts.js @@ -460,7 +460,7 @@ export default { each(boxes.chartArea, (layout) => { const box = layout.box; Object.assign(box, chart.chartArea); - box.update(chartArea.w, chartArea.h); + box.update(chartArea.w, chartArea.h, {left: 0, top: 0, right: 0, bottom: 0}); }); } }; diff --git a/test/fixtures/plugin.legend/legend-line-chart-area.json b/test/fixtures/plugin.legend/legend-line-chart-area.json new file mode 100644 index 000000000..e3e2520a1 --- /dev/null +++ b/test/fixtures/plugin.legend/legend-line-chart-area.json @@ -0,0 +1,35 @@ +{ + "config": { + "type": "line", + "data": { + "labels": ["A", "B", "C", "D", "E"], + "datasets": [{ + "data": [10, 20, 30, 40, 50], + "backgroundColor": "#00ff00", + "borderWidth": 0, + "label": "" + }] + }, + "options": { + "plugins": { + "legend": { + "position": "chartArea" + } + }, + "scales": { + "x": { + "display": false + }, + "y": { + "display": false + } + } + } + }, + "options": { + "canvas": { + "height": 256, + "width": 512 + } + } +} \ No newline at end of file diff --git a/test/fixtures/plugin.legend/legend-line-chart-area.png b/test/fixtures/plugin.legend/legend-line-chart-area.png new file mode 100644 index 0000000000000000000000000000000000000000..f3b020f7bf66559aee4bb03dca948f3c586b9c98 GIT binary patch literal 3665 zcmeH~Z%h+s7{K4VR#yJD$oLbiAb*NLL`oJGE39_36N_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