fix(chart): repair the component across its twelve types - #140
Open
LeadcodeDev wants to merge 1 commit into
Open
fix(chart): repair the component across its twelve types#140LeadcodeDev wants to merge 1 commit into
LeadcodeDev wants to merge 1 commit into
Conversation
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
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.
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::Clearon the shared canvas. 19380 transparent pixels inmega-showcase.json, now zero.Negatives escaped the box in five types — a
barwith 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-pointlinerendered nothing at all.The case that opened the issue renders correctly:
horizontal_barwith 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.jsonchanges 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 emptydataarray renders blank while validating clean.