Expand description
GridCraft charts (layer L3, toolkit-free).
resolvepulls series names, categories and values out of a workbook,renderlays a chart out into a list of drawing primitives (Prim) that any UI toolkit (or the built-inrasterize) can paint,render_sparklinedraws in-cell sparklines,rasterizeturns primitives into RGBA pixels for PNG export and tests.
The look (palette, greys, spacing) is GridCraft’s own design.
Re-exports§
pub use crate::model::Chart;pub use crate::model::ChartKind;pub use crate::model::LegendPos;pub use crate::model::SparklineKind;pub use crate::model::Trendline;pub use crate::model::TrendlineKind;
Structs§
- Approx
Measure - Fixed-width approximation:
0.55 × sizeper character (bold 10% wider). - Chart
Data - Resolved data: series names, categories and values pulled from the workbook.
- Scale
- A linear axis scale:
min..=maxwith gridlines everystep. - Series
Data - Trendline
Data - A trendline to draw: the model settings with the line colour resolved against the theme.
Enums§
- HAlign
- Prim
- A drawing primitive in chart coordinates (origin top-left, y down, units = points/pixels).
- Swatch
- How a legend entry’s swatch is drawn.
- VAlign
Traits§
- Measure
- Measures text width (the UI passes real font metrics; tests use a fixed-width approximation).
Functions§
- default_
palette - The first
nseries colours fortheme. - format_
number - Formats a number with a format code (General shows up to the precision implied by
step). - legend_
entries - Legend entries (text, colour, swatch)
renderdraws for this chart; empty when hidden. - nice_
scale - Picks a “nice” scale (steps of 1, 2 or 5 × 10ⁿ, 4–9 gridlines) covering
lo..=hi. - rasterize
- Rasterises primitives to straight RGBA8 (
w*h*4bytes) overbackground. Empty for a zero or oversized image. Text primitives are skipped. - render
- Lays out and draws a chart into a
w×hbox at the origin. Empty for a degenerate box. - render_
sparkline - Draws a sparkline into a
w×hbox at the origin. Gaps (None) break lines; column and win/loss sparklines draw negatives in our “down” red. - resolve
- Evaluates a chart’s series formulas: names, values, categories (default “1”, “2”, …), X values (scatter/bubble), bubble sizes, number formats and colours (explicit, else the default palette derived from the workbook theme accents).
- series_
color - Colour of the
i-th series: theme accents 1–6, then tinted variations of them. - series_
plot_ kind - The kind series
iofchartis drawn as: its own kind in a combo chart, else the chart’s. - supports_
trendline - Whether series drawn as
kshow trendlines (Excel offers them on 2-D unstacked column, bar, line, area, scatter and bubble charts).
Type Aliases§
- Rgba
- Straight (non-premultiplied) RGBA colour.