Skip to content

Commit 0f91b1a

Browse files
committed
remove ai cruft
1 parent 4d8442b commit 0f91b1a

3 files changed

Lines changed: 1 addition & 46 deletions

File tree

examples/official-site/examples/chart_hide_legend.sql

Lines changed: 0 additions & 13 deletions
This file was deleted.

sqlpage/apexcharts.js

Lines changed: 1 addition & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,6 @@
11
/* !include https://cdn.jsdelivr.net/npm/apexcharts@5.3.6/dist/apexcharts.min.js */
22

33
sqlpage_chart = (() => {
4-
/**
5-
* Coerces SQL values to booleans.
6-
* SQLite often returns booleans as 0/1 integers.
7-
* @param {unknown} value
8-
* @param {boolean} defaultValue
9-
* @returns {boolean}
10-
*/
11-
function sqlBoolean(value, defaultValue = false) {
12-
if (value == null) return defaultValue;
13-
if (typeof value === "boolean") return value;
14-
if (typeof value === "number") return value !== 0;
15-
if (typeof value === "string") {
16-
const normalized = value.trim().toLowerCase();
17-
if (normalized === "0" || normalized === "false") return false;
18-
if (normalized === "1" || normalized === "true") return true;
19-
}
20-
return Boolean(value);
21-
}
22-
234
function sqlpage_chart() {
245
for (const c of document.querySelectorAll("[data-pre-init=chart]")) {
256
try {
@@ -175,7 +156,7 @@ sqlpage_chart = (() => {
175156
palette: "palette4",
176157
},
177158
legend: {
178-
show: sqlBoolean(data.show_legend, true),
159+
show: data.show_legend === null || !!data.show_legend,
179160
},
180161
dataLabels: {
181162
enabled: !!data.labels,

tests/end-to-end/official-site.spec.ts

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -35,19 +35,6 @@ test("chart supports hiding legend", async ({ page }) => {
3535
await expect(expensesChart.locator(".apexcharts-legend")).toBeHidden();
3636
});
3737

38-
test("chart supports hiding legend with SQL boolean false", async ({
39-
page,
40-
}) => {
41-
await page.goto(`${BASE}/examples/chart_hide_legend.sql`);
42-
43-
const chart = page.locator(".card", {
44-
has: page.getByRole("heading", { name: "Legend Hidden" }),
45-
});
46-
47-
await expect(chart.locator(".apexcharts-canvas")).toBeVisible();
48-
await expect(chart.locator(".apexcharts-legend")).toBeHidden();
49-
});
50-
5138
test("map", async ({ page }) => {
5239
await page.goto(`${BASE}/documentation.sql?component=map#component`);
5340
await expect(page.getByText("Loading...")).not.toBeVisible();

0 commit comments

Comments
 (0)