Skip to content

Commit d6582eb

Browse files
committed
[FIX] calendar chart: hide scales borders
The calendar chart grid lines aren't shown, but the borders between chartArea and the ticks labels was still shown. Depending on the screen, zoom, and size of the chart, the border would be more or less visible. This commit hides these borders. Task: 5357420
1 parent d71feef commit d6582eb

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

src/helpers/figures/charts/runtime/chartjs_scales.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,7 @@ export function getCalendarChartScales(
118118
grid: {
119119
display: false,
120120
},
121+
border: { display: false },
121122
},
122123
x: {
123124
title: getChartAxisTitleRuntime(definition.axesDesign?.x),
@@ -129,6 +130,7 @@ export function getCalendarChartScales(
129130
ticks: {
130131
color: fontColor,
131132
},
133+
border: { display: false },
132134
},
133135
};
134136
}

tests/figures/chart/calendar/calendar_chart_plugin.test.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import {
22
CalendarChartGranularity,
33
CalendarChartRuntime,
44
} from "@odoo/o-spreadsheet-engine/types/chart/calendar_chart";
5+
import { ScaleChartOptions } from "chart.js";
56
import { ChartCreationContext, Model } from "../../../../src";
67
import { CalendarChart } from "../../../../src/helpers/figures/charts/calendar_chart";
78
import { createCalendarChart, createSheet, setCellContent, setFormat } from "../../../test_helpers";
@@ -231,4 +232,17 @@ describe("calendar chart", () => {
231232
expect(runtime.chartJsConfig.data.labels).toEqual(grouping.labels);
232233
}
233234
);
235+
236+
test("Axis borders are not shown in calendar charts", () => {
237+
const model = new Model();
238+
createCalendarChart(
239+
model,
240+
{ type: "calendar", dataSets: [{ dataRange: "B1:B365" }] },
241+
"chartId"
242+
);
243+
const runtime = model.getters.getChartRuntime("chartId") as CalendarChartRuntime;
244+
const scales = runtime.chartJsConfig.options?.scales as ScaleChartOptions<"bar">["scales"];
245+
expect(scales?.x?.border?.display).toBe(false);
246+
expect(scales?.y?.border?.display).toBe(false);
247+
});
234248
});

0 commit comments

Comments
 (0)