Skip to content

Commit 0de6c33

Browse files
committed
[FIX] chart: clip show value text to chart area
The text of the "Show Value" feature can go out of the chart and overlap with the legend/title. This commit clips the text to the chart area. closes #7293 Task: 5125970 X-original-commit: ff8bba9 Signed-off-by: Rémi Rahir (rar) <rar@odoo.com> Signed-off-by: Adrien Minne (adrm) <adrm@odoo.com>
1 parent 436323d commit 0de6c33

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/components/figures/chart/chartJs/chartjs_show_values_plugin.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,10 @@ export const chartShowValuesPlugin: Plugin = {
2929
}
3030
const ctx = chart.ctx as CanvasRenderingContext2D;
3131
ctx.save();
32+
const { left, top, height, width } = chart.chartArea;
33+
ctx.beginPath();
34+
ctx.rect(left, top, width, height);
35+
ctx.clip();
3236

3337
ctx.textAlign = "center";
3438
ctx.textBaseline = "middle";

0 commit comments

Comments
 (0)