docs: recharts chart techniques from AI builder field notes#6778
docs: recharts chart techniques from AI builder field notes#6778amsraman wants to merge 5 commits into
Conversation
Gradient fills (area/bar/pie), rounded bars, axis label styling, per-slice cell coloring, series shapes, tick/grid styling, and click-drilldown + hover-event recipes. All demos exec-verified. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Merging this PR will not alter performance
Comparing Footnotes
|
Greptile SummaryThis PR upstreams the third batch of Recharts charting techniques from Reflex Build's AI-builder knowledge base into the public docs, covering gradient fills, rounded bars, per-slice cell coloring, hover/click drill-down interactivity, axis/label/grid styling, and multi-shape scatter series. It also fixes the docgen pipeline's
Confidence Score: 5/5Documentation-only additions with a targeted pipeline bug fix; no runtime logic or data paths are affected. All changes are docs examples and a narrow parsing fix in the docgen pipeline. Previous review feedback on id-shadowing and the unguarded color-index in the pie hover example has been fully addressed. The gradient examples use consistent IDs between their defs blocks and url() references, and the interactive drilldown/hover patterns correctly bind event arguments at render time via rx.foreach. No functional regressions are introduced. No files require special attention. Important Files Changed
Reviews (4): Last reviewed commit: "docs: forward strokeWidth/cursor via cus..." | Re-trigger Greptile |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 3e2de46c5e
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| outer_radius="80%", | ||
| padding_angle=2, | ||
| stroke="#fff", | ||
| stroke_width=2, |
There was a problem hiding this comment.
Use a supported prop for pie slice stroke width
In these pie demos, stroke_width is not a declared prop on rx.recharts.pie (checked the Pie wrapper in packages/reflex-components-recharts/src/reflex_components_recharts/polar.py), so Reflex treats it as a style key and renders it via wrapperStyle rather than forwarding strokeWidth to Recharts. Users copying this example therefore won't get the advertised slice separator width (the gradient demo below has the same issue); use custom_attrs={"strokeWidth": 2} or expose a real stroke_width prop.
Useful? React with 👍 / 👎.
…aram to gradient_id
…bstring
The graphing demo renderer separated the data prelude from the chart
function with content.rpartition('def'), which also matches inside
rx.el.svg.defs(...). The new gradient chart examples use defs, so the
split landed mid-identifier and handed ruff_format two truncated,
unparseable halves, failing the docs double-eval tests. Split on a
line-starting 'def ' instead.
…el until hover - Pie separator width and the drill-down pointer cursor were passed as stroke_width / cursor props, which Reflex emits into wrapperStyle (dead) rather than the underlying SVG. Route both through custom_attrs so they actually apply. - The pie hover example rendered hovered_value unconditionally, showing a '0' in the donut center before any hover. Gate the center label on a hovered slice, with a 'Hover a slice' hint otherwise.
|
Thanks — all three addressed in 3f2b288. I verified each against Reflex 0.9.6 by rendering the component and inspecting the emitted props: [P2] Pie separator width ignored. Confirmed: [P3] Drill-down pointer cursor. Same wrapperStyle problem for [P3] Hover state does not clear. The center label rendered |
Third batch of upstreaming Reflex Build's AI-builder knowledge base into the docs (#6775, #6777). Recharts techniques the chart pages lacked:
rx.el.svg.defs+linear_gradient,fill="url(#id)"), rounded bars (radius)rx.recharts.label+custom_attrs, rotated y-label)rx.foreach+rx.recharts.cellwith an indexed palette, radial gradient fillsshapeon_click(baron_clickprovides no args) and hover events with cell-index bindingFlexgen house style (custom HTML legends, tooltip prop constants) was deliberately stripped — only generic techniques upstreamed. Pages whose memories were already covered (radar, funnel, composed) were left untouched. All new demos exec-verified; pre-commit clean.
🤖 Generated with Claude Code