remove ai cruft
This commit is contained in:
@@ -1,13 +0,0 @@
|
||||
SELECT
|
||||
'chart' AS component,
|
||||
'Legend Hidden' AS title,
|
||||
'line' AS type,
|
||||
FALSE AS show_legend;
|
||||
|
||||
SELECT 'Marketing' AS series, 2023 AS x, 30 AS y
|
||||
UNION ALL
|
||||
SELECT 'Marketing', 2024, 45
|
||||
UNION ALL
|
||||
SELECT 'Sales', 2023, 35
|
||||
UNION ALL
|
||||
SELECT 'Sales', 2024, 50;
|
||||
+1
-20
@@ -1,25 +1,6 @@
|
||||
/* !include https://cdn.jsdelivr.net/npm/apexcharts@5.3.6/dist/apexcharts.min.js */
|
||||
|
||||
sqlpage_chart = (() => {
|
||||
/**
|
||||
* Coerces SQL values to booleans.
|
||||
* SQLite often returns booleans as 0/1 integers.
|
||||
* @param {unknown} value
|
||||
* @param {boolean} defaultValue
|
||||
* @returns {boolean}
|
||||
*/
|
||||
function sqlBoolean(value, defaultValue = false) {
|
||||
if (value == null) return defaultValue;
|
||||
if (typeof value === "boolean") return value;
|
||||
if (typeof value === "number") return value !== 0;
|
||||
if (typeof value === "string") {
|
||||
const normalized = value.trim().toLowerCase();
|
||||
if (normalized === "0" || normalized === "false") return false;
|
||||
if (normalized === "1" || normalized === "true") return true;
|
||||
}
|
||||
return Boolean(value);
|
||||
}
|
||||
|
||||
function sqlpage_chart() {
|
||||
for (const c of document.querySelectorAll("[data-pre-init=chart]")) {
|
||||
try {
|
||||
@@ -175,7 +156,7 @@ sqlpage_chart = (() => {
|
||||
palette: "palette4",
|
||||
},
|
||||
legend: {
|
||||
show: sqlBoolean(data.show_legend, true),
|
||||
show: data.show_legend === null || !!data.show_legend,
|
||||
},
|
||||
dataLabels: {
|
||||
enabled: !!data.labels,
|
||||
|
||||
@@ -35,19 +35,6 @@ test("chart supports hiding legend", async ({ page }) => {
|
||||
await expect(expensesChart.locator(".apexcharts-legend")).toBeHidden();
|
||||
});
|
||||
|
||||
test("chart supports hiding legend with SQL boolean false", async ({
|
||||
page,
|
||||
}) => {
|
||||
await page.goto(`${BASE}/examples/chart_hide_legend.sql`);
|
||||
|
||||
const chart = page.locator(".card", {
|
||||
has: page.getByRole("heading", { name: "Legend Hidden" }),
|
||||
});
|
||||
|
||||
await expect(chart.locator(".apexcharts-canvas")).toBeVisible();
|
||||
await expect(chart.locator(".apexcharts-legend")).toBeHidden();
|
||||
});
|
||||
|
||||
test("map", async ({ page }) => {
|
||||
await page.goto(`${BASE}/documentation.sql?component=map#component`);
|
||||
await expect(page.getByText("Loading...")).not.toBeVisible();
|
||||
|
||||
Reference in New Issue
Block a user