Skip to content

Commit 5354d6a

Browse files
81reaplovasoa
andauthored
fix(chart) :: change tootltip title colour to be visible (#1401)
Co-authored-by: Ophir LOJKINE <contact@ophir.dev>
1 parent f454791 commit 5354d6a

3 files changed

Lines changed: 22 additions & 0 deletions

File tree

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@
2222
- List-valued configuration options, including OIDC paths and trusted audiences, can now be set through environment variables as space-separated lists.
2323
- `sqlpage.fetch_with_meta` now correctly documents server JSON responses sent under `json_body`, not `body`.
2424
- Datagrid rows with an icon or image no longer display an unnecessary en-dash placeholder, and an explicitly empty description remains empty.
25+
- Tooltip title text is now inhertis the same colour as the tooltip text.
26+
- Charts can display reference lines. A row with a `yline` is drawn as a line across the chart at that value of the y axis, with the row's `label` and `color` for its text and its color. Reference lines are rows, so a chart can have as many of them as the query returns. A line follows its axis, so on a `horizontal` bar chart a `yline` is drawn down the chart rather than across it. They are not added to the total of a `stacked` chart, and are not filled in an `area` chart.
2527
- Charts can display reference lines. A row with a `yline` is drawn as a line across the chart at that value of the y axis, and a row with `xline` marks a position on the x axis. `label` and `color` set the line's text and its color. Reference lines are rows, so a chart can have as many of them as the query returns. A line follows its axis, so on a `horizontal` bar chart a `yline` is drawn down the chart rather than across it. They are not added to the total of a `stacked` chart, and are not filled in an `area` chart.
2628

2729
## v0.45

sqlpage/sqlpage.css

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,10 @@ code {
6060
font-weight: var(--tblr-body-font-weight);
6161
}
6262

63+
.apexcharts-tooltip .apexcharts-tooltip-title {
64+
color: inherit;
65+
}
66+
6367
/** table **/
6468
.table-freeze-headers thead {
6569
position: sticky;

tests/end-to-end/chart-component.spec.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -387,6 +387,22 @@ test("draws a rangeBar chart that asks to be stacked", async ({ page }) => {
387387
expect(chart.stacked).toBe(false);
388388
});
389389

390+
test("gives the tooltip title the color of the tooltip around it", async ({
391+
page,
392+
}) => {
393+
await renderChart(page, { type: "line" }, A_DAY_OF_WORK);
394+
await page.locator("#test-chart .apexcharts-inner").hover({ force: true });
395+
396+
const title = page.locator("#test-chart .apexcharts-tooltip-title");
397+
await expect(title).toHaveText("Tue");
398+
const colors = await title.evaluate((el) => ({
399+
title: getComputedStyle(el).color,
400+
tooltip: getComputedStyle(el.parentElement as HTMLElement).color,
401+
}));
402+
403+
expect(colors.title).toBe(colors.tooltip);
404+
});
405+
390406
test("draws a reference line that carries no label", async ({ page }) => {
391407
const chart = await renderChart(page, { type: "line" }, [
392408
...A_IN_EVERY_QUARTER,

0 commit comments

Comments
 (0)