rusackas opened a new pull request, #42151: URL: https://github.com/apache/superset/pull/42151
### SUMMARY Follow-up to #35459, which added `Start angle` / `Sweep angle` controls to the Pie chart with a hardcoded layout table that only recentered half-donuts at exact cardinal start angles (0°/90°/180°/270°), and left partial arcs at full-circle sizing (so a half donut wasted roughly half the canvas). This PR replaces that table with layout derived from the arc's actual geometry: - `getArcBoundingBox` computes the arc's bounding box from the start/sweep angles and inner radius (outer endpoints, inner endpoints, and every axis extreme the arc sweeps through). - `getPieLayout` scales the radius until that box fills the padded series rect, capped at the 2× factor a quarter arc reaches naturally, and shifts the pie origin so the box is centered. Partial arcs reclaim the space a full circle would leave empty. - Recentering applies to any start/sweep combination, which removes the behavior cliff where nudging the start angle from 180° to 170° made the chart jump off-center. - The Total label is anchored on the pie origin with `align`/`verticalAlign` centering instead of empirically tuned percentage offsets, and is clamped into the arc's box so narrow arcs keep it on-canvas. With side legends the label is centered exactly in the padded rect rather than approximated with fudge factors. - A full circle reproduces the ECharts default layout exactly, so existing charts are unchanged (locked in by tests). The magic-constant table, `getHalfDonut`, and `getTotalValuePadding` are deleted; the sweep-angle control description is updated accordingly and translation catalogs are synced for the reworded string. Verified visually across a 12-configuration matrix (full, all four halves, quarter, non-cardinal 170°, diagonal 45°, 20° sliver, 270° arc, legend padding, non-donut half) rendered with ECharts. ### BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF Before: a half donut with `Start angle` 170° rendered off-center at full-circle size; only exact cardinal angles recentered, without scaling. After: every partial arc is centered and scaled to use the available space. Screenshots incoming in a comment. ### TESTING INSTRUCTIONS 1. Create a Pie chart, enable Donut, and set `Sweep angle` to 180°. The chart should render centered and noticeably larger than before. 2. Try `Start angle` values that are not multiples of 90° (e.g. 170°): the chart stays centered instead of jumping. 3. Set `Sweep angle` to 90° for a quarter donut: it scales up to fill the canvas. 4. Enable `Show Total` with and without legends on each side; the total stays centered on the donut hole (or the top of the chart for non-donut pies). 5. A full 360° sweep renders identically to current `master`. ### ADDITIONAL INFORMATION <!--- Check any relevant boxes with "x" --> - [ ] Has associated issue: - [ ] Required feature flags: - [x] Changes UI - [ ] Includes DB Migration (follow approval process in [SIP-59](https://github.com/apache/superset/issues/13351)) - [ ] Migration is atomic, supports rollback & is backwards-compatible - [ ] Confirm DB migration upgrade and downgrade tested - [ ] Runtime estimates and downtime expectations provided - [ ] Introduces new feature or API - [ ] Removes existing feature or API 🤖 Generated with [Claude Code](https://claude.com/claude-code) -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
