[WEB-4889] refactor: add fill in bar chart bar stroke#7776
[WEB-4889] refactor: add fill in bar chart bar stroke#7776sriramveeraghanta merged 3 commits intopreviewfrom
Conversation
|
Note Other AI code review bot(s) detectedCodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review. WalkthroughRefactors bar color handling: narrows Changes
Sequence Diagram(s)sequenceDiagram
autonumber
actor User
participant Data as Chart Data
participant Root as BarChartRoot
participant Color as getBarColor
participant Bar as Bar
participant Shape as CustomBar / Lollipop
participant SVG as SVG
User->>Root: Render chart
Root->>Data: Read series and bars
loop For each bar/segment
Root->>Color: getBarColor(data, bar.key)
Color-->>Root: fill:string
Root->>Bar: props { fill:string, ... }
Bar->>Shape: render with fill:string
Shape->>SVG: draw path/circle with fill/stroke
end
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Suggested reviewers
Pre-merge checks (2 passed, 1 warning)❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
⏰ 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)
✨ Finishing touches
🧪 Generate unit tests
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. Comment |
|
Pull Request Linked with Plane Work Items
Comment Automatically Generated by Plane |
There was a problem hiding this comment.
Pull Request Overview
This PR refactors the bar chart component to simplify how fill colors are applied to bars by removing the ability to pass functions as fill values and requiring a string fill value instead.
- Simplified the
fillprop inTBarPropsfromstring | ((payload: any) => string)to juststring - Updated bar rendering logic to use the fill value directly instead of checking if it's a function
- Added
fillprop and related dependencies to the bar chart'suseMemodependency array
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| packages/propel/src/charts/bar-chart/root.tsx | Added fill prop to bar component and updated useMemo dependencies |
| packages/propel/src/charts/bar-chart/bar.tsx | Simplified fill prop type and removed function-based fill logic |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
There was a problem hiding this comment.
Actionable comments posted: 2
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
packages/propel/src/charts/bar-chart/root.tsx (1)
61-84: Correct getBarColor parameter typing to match Recharts tooltip payload.Using Record<string, string>[] makes item.dataKey/item.payload invalid. Use any[] (or TooltipPayload if you prefer strict typing).
- const getBarColor = useCallback( - (payload: Record<string, string>[], barKey: string) => { + const getBarColor = useCallback( + (payload: any[], barKey: string) => {Optional stricter typing:
// import type { TooltipPayload } from "recharts"; // (payload: TooltipPayload<any, any>[], barKey: string) => { ... }
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
packages/propel/src/charts/bar-chart/bar.tsx(3 hunks)packages/propel/src/charts/bar-chart/root.tsx(1 hunks)
⏰ 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: Build and lint web apps
- GitHub Check: Analyze (javascript)
🔇 Additional comments (3)
packages/propel/src/charts/bar-chart/bar.tsx (3)
111-113: LGTM: path now uses resolved string fill.
134-137: LGTM: lollipop line stroke aligned to fill.
160-169: Dynamic color resolution moved to factory — good containment.Resolving bar.fill(payload) here ensures components only receive strings.
* ♻️ refactor: add fill in barchart bar stroke * ♻️ refactor: added fill in the circle
Description
Added fill to bar chart bar fill
Type of Change
Summary by CodeRabbit
New Features
Bug Fixes