Component | RadialBar: Add barMinAngle config property - #114
Draft
rokotyan wants to merge 5 commits into
Draft
Conversation
The `value` accessor result was coerced with `?? 0`, making a missing value indistinguishable from a real `0`. Keep it as `null` instead, so the arc stays collapsed and hidden, and let `0` be rendered as an actual data point. `RadialBarArcDatum.value` is now `number | null` accordingly. Also make the default `id` accessor null-safe: with gaps in the data, the record itself can be `null`, which used to throw when reading `d.id`. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Bars representing tiny values were collapsing into an invisible hairline. `barMinAngle` sets the minimum angular extent of a bar in radians, `0` values included, so that they stay on screen. It defaults to `0.01`, which is about one pixel wide on a ring of a 100 pixel radius, and it's clamped to the length of `angleRange`. Bars with missing values are unaffected: they're never drawn. The minimum is applied along the sweep direction, so reversed angle ranges, e.g. `[0, -2 * Math.PI]`, keep rendering counter-clockwise. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Hand-written to match the generated style: `pnpm generate` currently rewrites every component's imports into internal `@/*` alias paths, which don't resolve in this package. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Side-by-side cases for `barMinAngle`: disabled, the default, a large value, combined with `padAngle`, half and reversed angle ranges, and a value above the angle range to check clamping. The data covers a tiny value, a `0`, and a `null` to show that missing values stay unrendered. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Document `barMinAngle` with an interactive slider, and the difference between a `0` value and a missing one. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
f5#863
Bars representing tiny values collapse into an invisible hairline: a value of 0.05% of the max is 0.4px of arc, which the browser paints as nothing.
barMinAnglegives every bar a floor on its angular extent, the same idea asbarMinHeight1Pxin StackedBar, but expressed as an angle.barMinAngle0.01— about one pixel wide on a ring of a 100 pixel radius, so small values stay perceptible out of the box. Set it to0to get the old behavior back, or raise it to make them prominent.angleRange— a value larger than the range simply fills it (last panel above).[0, -2 * Math.PI], keep rendering counter-clockwise.Because the minimum is an angle, the same setting is thinner on inner rings (1.19px on the outermost ring vs 0.66px on the fourth, at the default). A pixel-exact floor would need a per-ring
minWidthPx / outerRadius; happy to switch if that reads better.0vs missing dataThe
valueaccessor result used to be coerced with?? 0, so a missing value and a real0were indistinguishable, and both drew nothing. They're now separate cases:0is a value — it getsbarMinAngleand shows up as a small tick, so an empty metric is visibly empty rather than absent.null/undefined/ non-finite is missing data — the arc stays collapsed and hidden, leaving only the background track.RadialBarArcDatum.valueisnumber | nullaccordingly, which is visible to tooltips and event handlers.While wiring this up I also made the default
idaccessor null-safe: with gaps in the data the record itself can benull(data={[0.5, null, 0.2]}), which used to throwCannot read properties of null (reading 'id')on the data join.Docs
Included
barMinAngleconfig property, missing-value handling, null-safe defaultidaccessor.@Input(). Hand-written to match the generated style:pnpm generatecurrently rewrites every component's imports into internal@/*alias paths, which don't resolve in that package (fallout from the alias migration, worth a separate fix). React / Vue / Svelte / Solid are generic over the config interface and need no change.Radial Bar Min Anglewith the cases in the screenshot above.0-vs-missing distinction.Verification
Measured the rendered bar bounding boxes in the dev app (rings of a ~107px radius,
trackWidth: 14):barMinAngle0valuenullvalue00.01(default)0.2Also checked the docs demo across slider positions, half and reversed angle ranges,
padAngleinterplay, and clamping.tsc --noEmitand eslint are clean; both core commits compile in isolation.