Skip to content

feat(line): add --smooth flag for 2D line charts#187

Merged
fahimfaisaal merged 5 commits into
goptics:mainfrom
hfl0506:feat/line-smooth
Jul 5, 2026
Merged

feat(line): add --smooth flag for 2D line charts#187
fahimfaisaal merged 5 commits into
goptics:mainfrom
hfl0506:feat/line-smooth

Conversation

@hfl0506

@hfl0506 hfl0506 commented Jul 4, 2026

Copy link
Copy Markdown
Collaborator

Related Issue

Resolve #186

Summary

  • Adds 2D smooth-line support for line charts.
  • Exposes the feature through CLI, --chart overrides, and the UI settings panel.
  • Keeps smooth lines unavailable for 3D line charts and non-line chart types.

Changes

  • Added line-only --smooth CLI flag and smooth line config field.
  • Added --chart line:smooth support via the chart flag registry.
  • Added Smooth lines UI toggle for 2D line charts.
  • Hid the UI toggle when the line chart renders in 3D mode.
  • Applied smooth: true to grouped, value-mode, and mixed-mode 2D ECharts line series.
  • Left line3D rendering unchanged.
  • Added backend and UI tests for flag registration, config materialisation, field visibility, store updates, and series options.
  • Updated line chart docs and settings docs.
  • Regenerated the embedded UI bundle in pkg/template/vizb-ui.gen.go.

Test Result

Testing Steps

  • Ran full Go test suite:
go test ./...
  • Built/regenerated embedded UI with Node 22:
cd ui
fnm use 22.23.1
corepack pnpm install --frozen-lockfile

EMBED_UI=True corepack pnpm build

  • Ran targeted UI tests:
cd ui
fnm use 22.23.1
corepack pnpm test \
  src/components/SettingsPanel.test.ts \
  src/composables/settings/fieldRegistry.test.ts \
  src/composables/useSettingsStore.test.ts \
  src/composables/charts/useLineChartOptions.test.ts
  • Smoke-tested --smooth CLI output:
go run . line examples/csv/sales.csv -g region,category -p x,y --smooth -o out.html
  • Verified generated HTML contains baked config:
rg -o '"smooth":true' out.html
  • Smoke-tested multi-chart override:
go run . examples/csv/sales.csv -g region,category -p x,y -c bar,line --chart line:smooth 

-o dashboard.html

  • Verified CLI flag exposure:
go run . line --help | rg smooth
go run . bar --help | rg smooth

expected below script exist for go run . line --help | rg smooth and not for go run . bar --help | rg smooth.

--smooth                 Render smooth curved segments between line chart points
  • Manually opened out.html and confirmed:
Screenshot 2026-07-04 at 9 36 18 AM Screenshot 2026-07-04 at 9 36 34 AM

@codecov-commenter

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@fahimfaisaal fahimfaisaal left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Hi, @hfl0506 Thanks for PR. Well Done.

Just have a doc change request.

The rest are LGTM. 👍️

Comment thread docs/src/content/docs/charts/line.mdx Outdated
@fahimfaisaal fahimfaisaal changed the title Feat/line smooth feat(line): add --smooth flag for 2D line charts Jul 5, 2026
@fahimfaisaal
fahimfaisaal merged commit cd7cac6 into goptics:main Jul 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[feat]: Add --smooth flag and UI toggle for 2D line charts

3 participants