Skip to content

feat(component): add DataZoom support for bar and line charts - #170

Closed
alfredo1996 wants to merge 3 commits into
devfrom
feat/issue-134-datazoom
Closed

feat(component): add DataZoom support for bar and line charts#170
alfredo1996 wants to merge 3 commits into
devfrom
feat/issue-134-datazoom

Conversation

@alfredo1996

@alfredo1996 alfredo1996 commented Mar 22, 2026

Copy link
Copy Markdown
Owner

Summary

Add scroll-to-zoom (DataZoom) as a shared BaseChart prop for bar and line charts. ECharts DataZoom (type: 'inside') enables exploration of large datasets by scrolling to zoom on both axes.

Changes

  • New prop: enableDataZoom on BaseChartProps (types.ts)
  • BaseChart: injects dataZoom: [{type: 'inside', xAxisIndex: 0}, {type: 'inside', yAxisIndex: 0}] when enabled
  • chart-options-schema: new "Enable Scroll Zoom" option for bar/line charts
  • 3 new tests: DataZoom injection, default off, explicit false

Test plan

  • cd component && npm test — 67 suites, 1012 tests passing
  • cd app && npm test — 72 suites, 1260 tests passing
  • npm run build — clean
  • npm run lint — clean

Closes #134

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features

    • Added data zoom capability to bar and line charts, enabling scroll-to-zoom interaction for intuitive data axis exploration.
  • Tests

    • Added unit tests for data zoom configuration behavior across multiple scenarios (enabled, disabled, and omitted states).

Add enableDataZoom prop to BaseChart that injects ECharts DataZoom
(type: 'inside') on both x and y axes. Users can scroll-to-zoom to
explore large datasets. Disabled by default (opt-in via chart options).

- New prop: enableDataZoom on BaseChartProps
- DataZoom injected into merged options when enabled
- Chart option exposed in chart-options-schema for bar/line
- 3 new tests for DataZoom behavior

Closes #134

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@alfredo1996 alfredo1996 added enhancement New feature or request pkg:component UI component library area:charts Chart rendering labels Mar 22, 2026
@coderabbitai

coderabbitai Bot commented Mar 22, 2026

Copy link
Copy Markdown

Warning

Rate limit exceeded

@alfredo1996 has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 23 minutes and 49 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 5c0f4391-1a07-4fd3-ae4e-2206e3e4fc41

📥 Commits

Reviewing files that changed from the base of the PR and between 7dd15c4 and 670bd51.

📒 Files selected for processing (3)
  • component/src/charts/__tests__/base-chart.test.tsx
  • component/src/charts/base-chart.tsx
  • component/vitest.setup.ts

Walkthrough

A new enableDataZoom boolean prop was added to BaseChart, allowing users to enable ECharts inside-type data zooming for bar and line charts. The feature conditionally injects zoom configuration into chart options, includes proper TypeScript types, and is exposed through the chart options schema with unit test coverage.

Changes

Cohort / File(s) Summary
BaseChart Implementation
component/src/charts/base-chart.tsx, component/src/charts/types.ts
Added enableDataZoom prop to BaseChartProps and implemented conditional injection of ECharts dataZoom configuration (type: 'inside') for xAxis and yAxis. Updated effect dependencies to trigger option recomputation when prop changes.
Chart Options Schema
component/src/components/composed/chart-options-schema.ts
Registered new dataZoomOptions containing the enableDataZoom option and integrated it into the option registry for bar and line chart types.
Unit Tests
component/src/charts/__tests__/base-chart.test.tsx
Added three test cases validating dataZoom configuration: undefined when disabled/omitted, properly structured array when enabled, and undefined when explicitly set to false.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The PR title accurately summarizes the main change: adding DataZoom support for bar and line charts, which directly matches the changeset content.
Linked Issues check ✅ Passed All acceptance criteria from issue #134 are met: enableDataZoom prop added to BaseChart, dataZoom works for both bar and line charts, exposed in chart-options-schema, and default-off behavior prevents unintended interactions.
Out of Scope Changes check ✅ Passed All changes directly support the DataZoom feature implementation. No unrelated modifications detected outside the scope of issue #134.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/issue-134-datazoom

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

alfredorubin96 and others added 2 commits March 23, 2026 01:39
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Conditionally include seriesName in tooltip formatter to prevent
  "undefined:" display when series name is not provided
- Remove decimalPlaces from bar/line/pie chart option registries where
  it was registered but never wired up

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@sonarqubecloud

Copy link
Copy Markdown

alfredo1996 pushed a commit that referenced this pull request Mar 24, 2026
…els, markLine, pie donut)

Merges PRs #169, #170, #171, #173, #174 into a single release branch.
Resolves merge conflicts in chart-utils.ts, bar-chart.tsx, line-chart.tsx,
and chart-options-schema.ts.

Includes:
- Number formatting for single-value and tooltips (#169)
- DataZoom support for bar and line charts (#170)
- Auto-rotate and truncate axis labels (#171)
- Reference lines (markLine) for bar and line charts (#173)
- Donut center text and Top-N grouping for pie chart (#174)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@alfredo1996

Copy link
Copy Markdown
Owner Author

Superseded by consolidated PR #185 (release/chart-improvements)

@alfredo1996
alfredo1996 deleted the feat/issue-134-datazoom branch March 29, 2026 22:22
alfredo1996 pushed a commit that referenced this pull request May 10, 2026
…els, markLine, pie donut)

Merges PRs #169, #170, #171, #173, #174 into a single release branch.
Resolves merge conflicts in chart-utils.ts, bar-chart.tsx, line-chart.tsx,
and chart-options-schema.ts.

Includes:
- Number formatting for single-value and tooltips (#169)
- DataZoom support for bar and line charts (#170)
- Auto-rotate and truncate axis labels (#171)
- Reference lines (markLine) for bar and line charts (#173)
- Donut center text and Top-N grouping for pie chart (#174)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:charts Chart rendering enhancement New feature or request pkg:component UI component library

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(component): add DataZoom support for bar and line charts

2 participants