feat(charts): add error accumulator in PieChart#11
Merged
Conversation
added 2 commits
November 19, 2025 11:12
Implement error accumulation pattern for PieChart following the same architecture as BarChart and LineChart. Includes validation for canvas, data, segments, and radius. Also optimizes useEffect dependencies across all chart components
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Contributor
🔍 PR Validation ReportStatus: ✅ PASSED ✅ Validation Results
🎯 Next StepsThis PR is ready for review - all validation checks passed! 📦 Expected Release ImpactBased on branch name This validation runs automatically on every PR. Questions? Check our Contributing Guidelines |
hectoruch
approved these changes
Nov 19, 2025
Contributor
✨ Auto-publish Successful!
📦 Installationnpm install @kubit-ui-web/react-charts@1.5.0
# or
yarn add @kubit-ui-web/react-charts@1.5.0✅ Completed Steps
🎉 Ready to use in production! |
miguelgarglez
pushed a commit
that referenced
this pull request
Dec 10, 2025
feat(charts): add error accumulator in PieChart
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
📋 Pull Request
📝 Description
Summary:
This PR implements a comprehensive error accumulator system for the PieChart component, following the same architecture pattern established in BarChart and LineChart. It adds real-time validation across all PieChart subcomponents (context, path, segment) with detailed error reporting through the
onErrorscallback.Context:
The PieChart component previously lacked structured error handling, making it difficult for developers to identify and debug data validation issues. This PR completes the error handling architecture across all major chart types in the library, ensuring consistency and developer-friendly debugging capabilities.
Related Issues:
🔄 Type of Change
🧪 Testing
Test Results
All tests passing ✅
New test files added:
Coverage highlights:
📸 Demo
Interactive Error Handling Story:
The new "PieChart With Error Handling" story in Storybook demonstrates real-time error detection with:
To see it in action:
Navigate to: Charts/PieChart/PieChart Examples > PieChart With Error Handling
📚 Documentation
🔍 Code Quality Checklist
Code Standards
Performance & Accessibility
Review & Testing
🚀 Deployment Considerations
📦 Dependencies
No new dependencies added. Changes use existing utilities and patterns.
🔗 Additional Information
Implementation Details
Error Accumulator Pattern:
createErrorAccumulatorutility for consistent error collectionDataKey "sales" not found in PieChart dataset)Performance Optimizations:
addError) from dependency arraysNew Error Types Added:
PIE_CHART_CONTEXT_ERROR- Canvas dimensions and configuration errorsPIE_CHART_PATH_ERROR- Data array, dataKey, and total validation errorsPIE_CHART_SEGMENT_ERROR- Individual segment validation errors (values, names, radius)New Error Builder Functions (9 total):
buildPieDataKeyNotFoundError- Missing dataKey in datasetbuildEmptyDataArrayError- Empty data array for keybuildInvalidTotalError- Zero or invalid total valuebuildSegmentValueError- Non-numeric segment valuebuildSegmentNegativeValueError- Negative segment valuebuildInvalidGroupError- Missing required properties (name/value)buildInvalidRadiusError- Invalid radius valuebuildInvalidInnerRadiusError- Invalid innerRadius valuebuildInnerRadiusOutOfRangeError- innerRadius >= radius constraintChart Constants Extended:
PIE_CHART_DEFAULTS(radius percentage: 50, minimum segments: 1)PIE_CHART_FALLBACK_DATAfor consistent fallback behaviorKey Files Modified
Core Implementation:
Error System:
Performance Optimizations:
Documentation & Stories:
Constants:
Breaking Changes
None. This is a purely additive feature:
onErrorsprop is optionalMigration Guide
No migration needed. To use the new error handling:
Notes for Reviewers
Key areas to focus on:
useEffect Dependency Optimization
Error Builder Functions (9 new functions)
PieChart Validation Logic
Storybook Integration
Pattern Consistency
📋 Reviewer Checklist