Skip to content

Automatically or Manually Scale Y-Axis in Line Chart #1619

Closed

Description

@atai92

See the line chart below.

Image

It's very difficult to see the trends of each line the graph above. There's a total of 6 lines that could differ in the pennies range, but that's not easily distinguishable from above.

If there was a way to set the min value on the Y-Axis to something closer to the minimum value of all points on the graph and set the max value of the Y-Axis to something close to the max value of all points on the graph, then it would be easier to visualize fluctuations between lines. Doing this automatically would be great, but having a manual option to configure this would be just as valuable.

Activity

  1. pulpdrew commented on Jun 4, 2026

    @pulpdrew
    Contributor

    @claude add a new Display Setting for time series (line / bar) charts that sets the y-axis lower bound to the lower bound of the displayed data (the default should remain lower bound = 0).

  2. github-actions commented on Jun 4, 2026

    @github-actions
    Contributor

    Claude finished @pulpdrew's task in 5m 55s —— View job • claude/issue-1619-20260604-1234 • Create PR ➔


    Task: Add Y-Axis Lower Bound Display Setting ✅

    • Explore display settings & time series chart code
    • Add fitYAxisToData setting to schemas (common-utils + external API)
    • Add "Fit Y-Axis to Data" checkbox to Display Settings drawer (line/bar only, default off)
    • Wire setting through EditTimeChartForm → DBTimeChart → MemoChart y-axis domain
    • Add unit tests for the new checkbox
    • Commit & push

    Summary

    I added a new "Fit Y-Axis to Data" display setting for time series (line / bar) charts. When enabled, the y-axis lower bound follows the minimum of the displayed data (with 10% padding) instead of being pinned at zero — making small fluctuations between many similar lines (like the pennies-range example in the issue) much easier to see. The default remains lower bound = 0, so existing charts are unaffected.

    How it works

    • New checkbox in Display Settings → "Fit Y-Axis to Data", shown only for Line and Stacked Bar charts.
    • The setting is persisted on the chart config (fitYAxisToData) so it survives save/reload, and is exposed in the External API v2 line/bar schemas for parity.
    • The y-axis domain logic in MemoChart now lets the lower bound drop to the data minimum when the setting is on (it still respects series-selection zoom and keeps the upper bound auto-scaled).

    Files changed

    • packages/common-utils/src/types.ts — added fitYAxisToData to SharedChartSettingsSchema
    • packages/api/src/utils/zod.ts — added fitYAxisToData to external line/bar chart schemas
    • packages/app/src/components/ChartDisplaySettingsDrawer.tsx — new checkbox + default
    • packages/app/src/components/DBEditTimeChartForm/EditTimeChartForm.tsx — watch/read/write the setting
    • packages/app/src/components/DBTimeChart.tsx — pass setting to the chart
    • packages/app/src/HDXMultiSeriesTimeChart.tsx — y-axis domain honors the setting
    • packages/app/src/components/__tests__/ChartDisplaySettingsDrawer.test.tsx — new tests

    Note on validation: make ci-lint / make ci-unit could not be run in this sandboxed environment (the build/test commands were blocked by the approval gate). However, the pre-commit hook (lint-staged) ran and passed on the changed files, and these checks will run in CI on the PR. Please confirm the CI run is green before merging.

    · Branch: claude/issue-1619-20260604-1234

  3. added a commit that references this issue on Jun 4, 2026
    998ea5d
  4. reopened this on Jun 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions