feat: add arc/pie support to observable-plot renderer#498
feat: add arc/pie support to observable-plot renderer#498ObservedObserver wants to merge 1 commit intomainfrom
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
ℹ️ 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".
| }, 0); | ||
| } | ||
|
|
||
| const radiusScale = radiusField && maxRadius > 0 ? (value: number) => Math.max(0, value) / maxRadius : () => 1; |
There was a problem hiding this comment.
Handle zero-only radius fields instead of defaulting to 1
When a radius encoding is provided but all radius values are 0, negative, or non-finite, maxRadius becomes 0 and radiusScale falls back to a constant 1. That makes every slice render at full radius even though the data implies a zero radius, which is a visible accuracy bug for charts with a radius field. Consider returning 0 (or skipping geometry) when maxRadius <= 0 so zero-only radius data doesn’t render full-size arcs.
Useful? React with 👍 / 👎.
Motivation
arc/pie charts while Vega-Lite produced such specs, causing inconsistent renderer parity.Description
createArcGeometryto tessellate an arc slice into a polygon suitable for Plot’sgeomark.createArcMarkwhich convertsthetaand optionalradiusencodings into per-row slice geometries and returns aPlot.geomark, and wired it intocreateMarkformarkType === 'arc'.plotOptionsto hide axes and setx/ydomains to[-1, 1]to normalize the radial layout.packages/graphic-walker/src/lib/observablePlot.test.tswith a new unit test asserting thegeomark is produced and axes are hidden for arc specs.Testing
arc chart renders with geo markwas added topackages/graphic-walker/src/lib/observablePlot.test.tsto cover the conversion logic but it was not run here.Codex Task
Note
Enables pie/arc charts in the Observable Plot renderer by generating polygonal slices and normalizing radial scales.
createArcGeometryto tessellate slice polygons andcreateArcMarkto maptheta/radiustoPlot.geomarkType === 'arc'throughcreateMark, producing ageomark with optional color-driven fill and white strokex/yfor arc charts:axis: nullanddomain: [-1, 1]for centered radial layoutgeoand addsarc chart renders with geo markassertinggeomark and hidden axesWritten by Cursor Bugbot for commit 4113d05. Configure here.