Skip to content

fix(chart): repair the component across its twelve types - #140

Open
LeadcodeDev wants to merge 1 commit into
mainfrom
fix/chart-component
Open

fix(chart): repair the component across its twelve types#140
LeadcodeDev wants to merge 1 commit into
mainfrom
fix/chart-component

Conversation

@LeadcodeDev

Copy link
Copy Markdown
Owner

Closes #138.

Audited all twelve types by rendering each standalone and in a card, flags off and on, measuring ink, bounding boxes, ink outside the box and text presence. Fourteen defects found, fourteen fixed, each with a before/after measurement in the commit message.

The finding that matters most is not a single bug: eleven of the twelve types render zero text by default, and four of them accept the label flags while honouring none — their renders with all flags on are byte-identical to all off.

The most severe was invisible in a chart and obvious in a frame: donut punched a fully transparent hole through the whole composited image, card background included, via BlendMode::Clear on the shared canvas. 19380 transparent pixels in mega-showcase.json, now zero.

Negatives escaped the box in five types — a bar with a −6 drew 58072 pixels past its bottom edge. A pie slice at exactly 100% of the total vanished (Skia emits an empty arc at a 360° sweep). A single-point line rendered nothing at all.

The case that opened the issue renders correctly: horizontal_bar with a zero value now shows both rows, both labels, the axis and the annotated values.

Regression-checked byte-for-byte across 36 fixtures: six types are unchanged for all-positive data. mega-showcase.json changes by 20396 px — 20181 of them the donut hole filling in.

Reported rather than built, per the issue's wording: labels and legends for pie/donut/radial_bar are absent entirely and adding them would change every existing render. Two items need files outside chart/: the legibility floor does not cover chart text, and an empty data array renders blank while validating clean.

Audited all twelve chart types by rendering each one standalone and inside a
card, with the label flags off and on, and measuring ink, bounding boxes, ink
outside the declared box, and text presence. Fourteen defects found, fourteen
fixed.

The headline is not any single bug: with default settings, eleven of the twelve
types render zero text. An author writing the documented minimal chart JSON gets
coloured shapes and nothing else. Four of them — pie, donut, radial_bar, radar —
accept the show_grid / show_x_labels / show_y_labels flags and honour none;
their renders with all four on are byte-identical to all four off.

The worst defect was invisible in a chart and obvious in a frame: donut punched
a fully transparent hole through the entire composited image, card background
included, because it cleared its centre with BlendMode::Clear on the shared
canvas. Measured at 19380 transparent pixels in mega-showcase.json; now zero.

Negative values escaped the component box in five types — a bar chart with a
-6 drew 58072 pixels past its bottom edge, and horizontal_bar reached the frame
edge. All five now anchor on a zero baseline and stay inside. Pie summed raw
values into its total, so one negative produced sweeps of 900 and -540 degrees.

Degenerate inputs that silently rendered nothing now render: a single-point line
or area drew no axes and no point; a pie slice at exactly 100% of the total
vanished because Skia emits an empty arc at a 360-degree sweep; a constant
series sat on the zero gridline, reading as a row of zeroes.

The case that opened the issue — horizontal_bar with one value at zero — was
missing its axis, its grid, both label sets and the zero row itself. It now
renders both rows with tracks, both names, a value axis and the values
annotated.

Regression-checked by re-rendering all 36 fixtures byte-for-byte: bar, pie,
funnel, radial_bar, stacked_bar and waterfall are unchanged for all-positive
data, since the signed-baseline arithmetic reduces to the old form when the
minimum is non-negative. mega-showcase.json changes by 20396 pixels, of which
20181 are the donut hole filling in and 215 are an axis label being pulled back
inside its card.

Left alone deliberately: waterfall, stacked_bar and area were checked and found
correct. Labels and legends for pie, donut and radial_bar are absent entirely —
adding them is feature work that would change every existing render, not a
repair, so it is reported rather than built.

Two things need files outside chart/: chart text is not covered by the
legibility floor (geometry.rs names it in its own "not covered" list), and an
empty data array renders blank while validating clean.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix(chart): audit and repair the chart component across its 12 types

1 participant