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 zc-rk(ZA?>F7(Vy5vX-wF86VNgclnCgl7+;8uoH zF^h$U5)foF+U&mdMveqzz9 z$197LE%!^>rJ>YGS8~rU>hzxMTzVe+gW*T$b#aJ1nx231yTcC(DL3>B4lT0SP-bS1 zq8krli>NealmHQQphvZ@%V1(P86!6zY0|}2m}VwUG-oV~egjReMqh3Q5KMhSHM?4@ zV->?Wyz(;eM-3}3UVs2qs7hfD`+{#9{pwlh9tNUi8B)O$e&F_Cf}|1AgMzjea+|gx z#x|qTsTVx_1eeCDu?`CnKATk2bsUv~>$e(@AUN<>*hf&|xl5k^5`l6H2B%4pDKc={ z$$5pSr11^+!oBeS51sOTcLe==UV0~VKy%88IBhH}Bhv9JyzNgr?XM`rEp z1fu%e5T&bMd52DB#{>Zr&Px3s^ z=I2?&gVvsZGJzOD2sAmlYTWrx#Bjlk-7=uW$~~!Vdf--%a&Q&cHC$0-@4ZOVpKd0$ zR9|6IHBUrJ{s>R`z`CNEw1$hfmIJ2( zx0(_@l2NjO$g)&- zDHya?uJ1z|NfdKU1`ok&vWAO7a=TW9O)#J#{+g3#(#7fG7!mMBP^NKf^Dp|^9B`gl gxJ~NCblcpNd3z01Z25jS{*MU6uSrDRnX