Skip to content

feat: add arc/pie support to observable-plot renderer#498

Open
ObservedObserver wants to merge 1 commit intomainfrom
codex/review-observable-plot-and-vega-lite-renderers
Open

feat: add arc/pie support to observable-plot renderer#498
ObservedObserver wants to merge 1 commit intomainfrom
codex/review-observable-plot-and-vega-lite-renderers

Conversation

@ObservedObserver
Copy link
Member

@ObservedObserver ObservedObserver commented Jan 1, 2026

Motivation

  • The Observable Plot renderer did not support arc/pie charts while Vega-Lite produced such specs, causing inconsistent renderer parity.
  • Pie/arc charts require custom geometry (slice polygons) rather than x/y marks, so the conversion needs to generate slice geometry and normalize radii.

Description

  • Added createArcGeometry to tessellate an arc slice into a polygon suitable for Plot’s geo mark.
  • Added createArcMark which converts theta and optional radius encodings into per-row slice geometries and returns a Plot.geo mark, and wired it into createMark for markType === 'arc'.
  • For arc charts, adjusted top-level plotOptions to hide axes and set x/y domains to [-1, 1] to normalize the radial layout.
  • Extended packages/graphic-walker/src/lib/observablePlot.test.ts with a new unit test asserting the geo mark is produced and axes are hidden for arc specs.

Testing

  • No automated test suite was executed as part of this change.
  • A unit test arc chart renders with geo mark was added to packages/graphic-walker/src/lib/observablePlot.test.ts to 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.

  • Introduces createArcGeometry to tessellate slice polygons and createArcMark to map theta/radius to Plot.geo
  • Wires markType === 'arc' through createMark, producing a geo mark with optional color-driven fill and white stroke
  • Adjusts top-level x/y for arc charts: axis: null and domain: [-1, 1] for centered radial layout
  • Updates tests: extends Plot mock with geo and adds arc chart renders with geo mark asserting geo mark and hidden axes

Written by Cursor Bugbot for commit 4113d05. Configure here.

@vercel
Copy link

vercel bot commented Jan 1, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Review Updated (UTC)
graphic-walker Ready Ready Preview, Comment Jan 1, 2026 9:13am

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 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;

Choose a reason for hiding this comment

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

P2 Badge 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 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant