Skip to content

Omnidoc: fix default values for polar charts, and Sankey#6682

Merged
ckifer merged 2 commits intomainfrom
defaultvalues
Nov 24, 2025
Merged

Omnidoc: fix default values for polar charts, and Sankey#6682
ckifer merged 2 commits intomainfrom
defaultvalues

Conversation

@PavelVanecek
Copy link
Collaborator

@PavelVanecek PavelVanecek commented Nov 24, 2025

Related Issue

#6069

Summary by CodeRabbit

  • New Features

    • Four new chart components now publicly available: PieChart, RadarChart, RadialBarChart, and Sankey.
  • Documentation

    • Updated API documentation and default values for new chart components with corrected margin defaults and property definitions.
    • Enhanced Storybook configuration for Sankey component with comprehensive argument types.

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Nov 24, 2025

Walkthrough

Four polar chart components (PieChart, RadarChart, RadialBarChart, Sankey) now export their default props constants. PolarChart exports defaultPolarChartProps as a base. ComponentMetaMap is extended to expose these new chart components. API documentation is updated to reflect actual default values.

Changes

Cohort / File(s) Summary
Chart component default props exports
src/chart/PolarChart.tsx, src/chart/PieChart.tsx, src/chart/RadarChart.tsx, src/chart/RadialBarChart.tsx, src/chart/Sankey.tsx
Exported new constants for component defaults: defaultPolarChartProps, defaultPieChartProps, defaultRadarChartProps, defaultRadialBarChartProps, and updated sankeyDefaultProps to export and add align: 'justify'. Polar chart variants now compose or extend defaultPolarChartProps.
Public component metadata mapping
omnidoc/componentsAndDefaultPropsMap.ts
Imported four new default props constants and expanded componentMetaMap to register PieChart, RadarChart, RadialBarChart, and Sankey with their respective default props.
Storybook centralization
storybook/stories/API/chart/Sankey.stories.tsx
Introduced SankeyArgTypes constant to centralize Storybook argTypes configuration for Sankey story instead of inline object definition.
API documentation updates
www/src/docs/api/PieChart.ts, www/src/docs/api/RadarChart.ts, www/src/docs/api/RadialBarChart.ts, www/src/docs/api/Sankey.ts
Removed or corrected defaultVal entries to reflect actual component defaults (e.g., converted string representations to literal values, updated margin defaults from { top: 0, ... } to { top: 5, ... }, removed null defaults for event handlers).

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

  • Pattern consistency: Export of defaults follows the same structure across five chart files; verify consistency of prop composition (e.g., how each chart extends defaultPolarChartProps)
  • ComponentMetaMap wiring: Ensure all four new chart entries are correctly imported and mapped
  • Documentation accuracy: Cross-reference API doc changes (margin, numeric/boolean conversions) against actual component default values to verify correctness
  • Sankey-specific changes: Review the reordering of properties in sankeyDefaultProps and the addition of align: 'justify' for impact

Possibly related PRs

Suggested reviewers

  • ckifer

Pre-merge checks and finishing touches

❌ Failed checks (2 warnings)
Check name Status Explanation Resolution
Description check ⚠️ Warning The description only includes a related issue link but is missing most required sections: motivation/context, testing details, screenshots, types of changes, and checklist items. Add missing sections: explain why default values needed fixing, describe testing performed, specify the change type (appears to be bug fix), and complete the checklist items.
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (1 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarizes the main changes: fixing default values for polar chart components (PieChart, RadarChart, RadialBarChart) and Sankey.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch defaultvalues

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.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (1)
storybook/stories/API/chart/Sankey.stories.tsx (1)

16-16: Address TODO comments for link and node descriptions.

The link and node properties are missing descriptions in the Storybook argTypes. Based on the API documentation in www/src/docs/api/Sankey.ts (lines 114-128), these should document that they can be either objects for configuration or ReactElements for custom rendering.

Do you want me to generate the descriptions for these properties based on the API documentation?

Also applies to: 27-27

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 04e10a8 and 06d17b7.

📒 Files selected for processing (11)
  • omnidoc/componentsAndDefaultPropsMap.ts (2 hunks)
  • src/chart/PieChart.tsx (1 hunks)
  • src/chart/PolarChart.tsx (3 hunks)
  • src/chart/RadarChart.tsx (1 hunks)
  • src/chart/RadialBarChart.tsx (1 hunks)
  • src/chart/Sankey.tsx (1 hunks)
  • storybook/stories/API/chart/Sankey.stories.tsx (1 hunks)
  • www/src/docs/api/PieChart.ts (1 hunks)
  • www/src/docs/api/RadarChart.ts (7 hunks)
  • www/src/docs/api/RadialBarChart.ts (6 hunks)
  • www/src/docs/api/Sankey.ts (6 hunks)
🧰 Additional context used
🧠 Learnings (3)
📓 Common learnings
Learnt from: PavelVanecek
Repo: recharts/recharts PR: 6659
File: www/src/components/GuideView/Performance/index.tsx:232-250
Timestamp: 2025-11-19T14:08:01.728Z
Learning: In Recharts version 3.4.2, object-as-prop optimizations were introduced to reduce unnecessary re-renders when new object references are passed as props. This affects the recommendation for the `react-perf/jsx-no-new-object-as-prop` ESLint rule.
📚 Learning: 2025-11-19T14:08:01.728Z
Learnt from: PavelVanecek
Repo: recharts/recharts PR: 6659
File: www/src/components/GuideView/Performance/index.tsx:232-250
Timestamp: 2025-11-19T14:08:01.728Z
Learning: In Recharts version 3.4.2, object-as-prop optimizations were introduced to reduce unnecessary re-renders when new object references are passed as props. This affects the recommendation for the `react-perf/jsx-no-new-object-as-prop` ESLint rule.

Applied to files:

  • src/chart/RadarChart.tsx
  • src/chart/PolarChart.tsx
  • src/chart/RadialBarChart.tsx
📚 Learning: 2025-11-23T13:30:10.388Z
Learnt from: PavelVanecek
Repo: recharts/recharts PR: 6669
File: www/src/docs/exampleComponents/ScatterChart/ScatterChartWithLabels.tsx:2-2
Timestamp: 2025-11-23T13:30:10.388Z
Learning: The `TooltipIndex` type from recharts is defined in `src/state/tooltipSlice.ts` but is not currently exported from the public API entry points. It should not be imported from `recharts/types/state/tooltipSlice` as this is an internal implementation path. An ESLint rule is needed to prevent regressions.

Applied to files:

  • src/chart/RadarChart.tsx
  • src/chart/RadialBarChart.tsx
  • src/chart/PieChart.tsx
🧬 Code graph analysis (5)
src/chart/RadarChart.tsx (3)
src/util/types.ts (2)
  • TooltipEventType (927-927)
  • PolarChartProps (1147-1188)
src/chart/PolarChart.tsx (1)
  • defaultPolarChartProps (19-33)
src/util/resolveDefaultProps.tsx (1)
  • resolveDefaultProps (16-53)
omnidoc/componentsAndDefaultPropsMap.ts (4)
src/chart/PieChart.tsx (1)
  • defaultPieChartProps (10-15)
src/chart/RadarChart.tsx (1)
  • defaultRadarChartProps (10-15)
src/chart/RadialBarChart.tsx (1)
  • defaultRadialBarChartProps (10-15)
src/chart/Sankey.tsx (1)
  • sankeyDefaultProps (840-851)
src/chart/RadialBarChart.tsx (3)
src/util/types.ts (2)
  • TooltipEventType (927-927)
  • PolarChartProps (1147-1188)
src/chart/PolarChart.tsx (1)
  • defaultPolarChartProps (19-33)
src/util/resolveDefaultProps.tsx (1)
  • resolveDefaultProps (16-53)
storybook/stories/API/chart/Sankey.stories.tsx (1)
storybook/StorybookArgs.ts (1)
  • StorybookArgs (59-61)
src/chart/PieChart.tsx (3)
src/util/types.ts (2)
  • TooltipEventType (927-927)
  • PolarChartProps (1147-1188)
src/chart/PolarChart.tsx (1)
  • defaultPolarChartProps (19-33)
src/util/resolveDefaultProps.tsx (1)
  • resolveDefaultProps (16-53)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
  • GitHub Check: Analyze (javascript-typescript)
  • GitHub Check: Build, Test, Pack
🔇 Additional comments (18)
src/chart/PolarChart.tsx (2)

19-33: LGTM: Public default props export.

The exported defaultPolarChartProps enables composition by downstream chart components and provides a centralized, type-safe source of default values for polar charts. The defaults for cx, cy, innerRadius, and outerRadius are appropriate.


69-69: LGTM: Consistent usage of exported defaults.

The chart correctly uses the newly exported defaultPolarChartProps for default prop resolution.

www/src/docs/api/RadialBarChart.ts (1)

34-34: LGTM: Documentation defaults align with implementation.

The updated defaultVal entries correctly reflect the defaults from defaultRadialBarChartProps (which composes defaultPolarChartProps).

Also applies to: 45-45, 65-65, 76-76, 107-107, 119-119

src/chart/PieChart.tsx (2)

10-15: LGTM: Proper composition of default props.

The defaultPieChartProps correctly composes defaultPolarChartProps and adds PieChart-specific defaults. The layout: 'centric' override is appropriate for pie charts.


18-18: LGTM: Consistent prop resolution.

The chart correctly uses the composed defaultPieChartProps for default prop resolution.

src/chart/RadialBarChart.tsx (2)

10-15: LGTM: Proper composition of default props.

The defaultRadialBarChartProps correctly composes defaultPolarChartProps and adds RadialBarChart-specific defaults.


18-18: LGTM: Consistent prop resolution.

The chart correctly uses the composed defaultRadialBarChartProps.

src/chart/RadarChart.tsx (2)

10-15: LGTM: Proper composition with radar-specific angles.

The defaultRadarChartProps correctly composes defaultPolarChartProps with radar-specific angle defaults (startAngle: 90, endAngle: -270).


18-18: LGTM: Consistent prop resolution.

The chart correctly uses the composed defaultRadarChartProps.

www/src/docs/api/PieChart.ts (1)

25-25: LGTM: Documentation margin default updated.

The updated margin defaultVal correctly reflects the default from defaultPolarChartProps (inherited by defaultPieChartProps).

omnidoc/componentsAndDefaultPropsMap.ts (2)

29-32: LGTM: Imports for new default props exports.

The imports correctly reference the newly exported default props constants.


54-54: LGTM: Public API mapping extended.

The componentMetaMap is correctly extended to expose the new default props for PieChart, RadarChart, RadialBarChart, and Sankey, enabling documentation generation and public API access.

Also applies to: 58-58, 60-60, 65-65

src/chart/Sankey.tsx (2)

840-851: LGTM: Sankey default props exported.

The sankeyDefaultProps is now exported for public API access and documentation generation. The addition of align: 'justify' as a default is consistent with the function signature at line 343.


995-995: LGTM: Consistent usage of exported defaults.

The Sankey component correctly uses the exported sankeyDefaultProps for default prop resolution.

storybook/stories/API/chart/Sankey.stories.tsx (1)

10-60: LGTM! Well-structured argTypes definition.

The SankeyArgTypes constant provides comprehensive documentation for Sankey chart properties. The default values are consistent with the API documentation and properly formatted for Storybook display.

www/src/docs/api/Sankey.ts (2)

67-67: LGTM! Proper type representation for default values.

The default values have been correctly updated from string representations to proper types:

  • sort: string 'true' → boolean true
  • nodePadding: string '10' → number 10
  • nodeWidth: string '10' → number 10
  • linkCurvature: string '0.5' → number 0.5
  • iterations: string '32' → number 32

This improves the accuracy of the API documentation.

Also applies to: 76-76, 85-85, 94-94, 103-103


164-172: No issues found - align property is correctly documented.

Verification confirms the align property documentation at lines 164-172 is accurate. The default value 'justify' matches the sankeyDefaultProps constant in src/chart/Sankey.tsx:841, the type specification 'left' | 'justify' is correct, and the property is properly marked as optional with a clear description.

www/src/docs/api/RadarChart.ts (1)

38-38: All documented default values match the source code.

Verification confirms that all default values in the documentation (lines 38, 49, 60, 70, 82, 94, 106) correctly reflect the actual defaultRadarChartProps and defaultPolarChartProps exported from src/chart/RadarChart.tsx and src/chart/PolarChart.tsx. No discrepancies found.

@codecov
Copy link

codecov bot commented Nov 24, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 94.02%. Comparing base (04e10a8) to head (06d17b7).
⚠️ Report is 2 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #6682      +/-   ##
==========================================
- Coverage   94.02%   94.02%   -0.01%     
==========================================
  Files         499      499              
  Lines       42575    42547      -28     
  Branches     4873     4873              
==========================================
- Hits        40032    40004      -28     
  Misses       2538     2538              
  Partials        5        5              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@ckifer ckifer merged commit 10d58e9 into main Nov 24, 2025
26 of 28 checks passed
@ckifer ckifer deleted the defaultvalues branch November 24, 2025 05:52
@codecov
Copy link

codecov bot commented Nov 24, 2025

Bundle Report

Changes will increase total bundle size by 11.57kB (0.44%) ⬆️. This is within the configured threshold ✅

Detailed changes
Bundle name Size Change
recharts/bundle-cjs 1.14MB 4.39kB (0.39%) ⬆️
recharts/bundle-es6 987.63kB 4.14kB (0.42%) ⬆️
recharts/bundle-umd 518.49kB 3.04kB (0.59%) ⬆️

Affected Assets, Files, and Routes:

view changes for bundle: recharts/bundle-umd

Assets Changed:

Asset Name Size Change Total Size Change (%)
Recharts.js 3.04kB 518.49kB 0.59%
view changes for bundle: recharts/bundle-es6

Assets Changed:

Asset Name Size Change Total Size Change (%)
chart/Sankey.js 7 bytes 25.73kB 0.03%
chart/PolarChart.js 93 bytes 4.52kB 2.1%
chart/RadialBarChart.js 1.35kB 2.21kB 157.14% ⚠️
chart/RadarChart.js 1.34kB 2.19kB 158.61% ⚠️
chart/PieChart.js 1.34kB 2.18kB 159.26% ⚠️
view changes for bundle: recharts/bundle-cjs

Assets Changed:

Asset Name Size Change Total Size Change (%)
chart/Sankey.js 58 bytes 27.41kB 0.21%
chart/PolarChart.js 152 bytes 5.5kB 2.84%
chart/RadialBarChart.js 1.41kB 3.11kB 82.87% ⚠️
chart/RadarChart.js 1.39kB 3.07kB 82.96% ⚠️
chart/PieChart.js 1.38kB 3.05kB 82.97% ⚠️

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