Skip to content

Chart: add show_legend toggle, document it, and add e2e test#1270

Merged
lovasoa merged 3 commits intomainfrom
codex/add-option-to-disable-chart-legend
Apr 7, 2026
Merged

Chart: add show_legend toggle, document it, and add e2e test#1270
lovasoa merged 3 commits intomainfrom
codex/add-option-to-disable-chart-legend

Conversation

@lovasoa
Copy link
Copy Markdown
Collaborator

@lovasoa lovasoa commented Apr 7, 2026

Motivation

  • Allow authors to disable the chart legend from SQL using a top-level boolean like false AS show_legend so charts can be rendered without the series legend when desired.
  • Keep frontend default behavior unchanged (legend shown) while allowing explicit control from the SQL payload.
  • Update the official-site documentation/examples so the new parameter is discoverable and used in an existing example.

Description

  • Added a new top-level property to the chart template payload by emitting "show_legend": {{stringify show_legend}} in sqlpage/templates/chart.handlebars so SQL values are passed to the client.
  • Wired the payload into ApexCharts options in sqlpage/apexcharts.js with legend: { show: data.show_legend !== false } so the legend is visible by default and hidden only when explicitly false.
  • Documented the parameter in examples/official-site/sqlpage/migrations/01_documentation.sql and updated the existing Expenses example to include "show_legend": false.
  • Added an end-to-end Playwright test in tests/end-to-end/official-site.spec.ts that loads the documentation page and asserts the Expenses chart renders while its legend is hidden.

Testing

  • Ran npm run format which completed successfully and formatted files.
  • Installed Playwright browsers with npx playwright install chromium and installed required host libs via apt-get to run headless tests successfully.
  • Ran the app under cargo run to serve examples/official-site and executed the Playwright e2e test chart supports hiding legend; the test passed.
  • Also ran cargo run -- --help during the workflow to verify the binary built and started as expected.

Codex Task

@lovasoa lovasoa linked an issue Apr 7, 2026 that may be closed by this pull request
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 375df59c3a

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@lovasoa lovasoa merged commit d11390a into main Apr 7, 2026
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Provide a parameter to charts component to hide the legend

1 participant