Skip to content

fix(charts): fit y-axis to data range for line and scatter charts#163

Merged
fahimfaisaal merged 1 commit into
mainfrom
fix/line-scatter-y-axis-scale
Jun 27, 2026
Merged

fix(charts): fit y-axis to data range for line and scatter charts#163
fahimfaisaal merged 1 commit into
mainfrom
fix/line-scatter-y-axis-scale

Conversation

@fahimfaisaal

Copy link
Copy Markdown
Member

Summary

ECharts includes zero on linear value axes by default, which wastes vertical space on line and scatter charts whose values never approach zero. This PR adds a fitYAxisToData option that sets yAxis.scale = true for line and scatter charts while bar charts keep the zero baseline.

Changes

  • Add fitYAxisToData parameter to createAxisConfig and createValueAxisConfig
  • Enable data-fitted Y axis for category-based line/scatter charts and value-mode line/scatter
  • Add unit tests covering bar (zero baseline), line/scatter (scale to data), and log scale behavior
  • Regenerate embedded UI bundle (pkg/template/vizb-ui.gen.go)

Test plan

  • pnpm vitest run src/composables/charts/shared/chartConfig.test.ts — 23 tests pass
  • Full UI test suite — 359 tests pass
  • Go test suite passes via pre-commit hook

ECharts includes zero on linear value axes by default, which wastes
vertical space on line and scatter charts whose values never approach
zero. Add a fitYAxisToData option to createAxisConfig and
createValueAxisConfig that sets yAxis.scale = true for line/scatter
while bar charts keep the zero baseline.

Includes unit tests and regenerated UI bundle.
@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 merged commit c14ce9f into main Jun 27, 2026
13 checks passed
@fahimfaisaal
fahimfaisaal deleted the fix/line-scatter-y-axis-scale branch June 27, 2026 03:28
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.

2 participants