Documentation
¶
Overview ¶
Package render lowers a resolved chart into IR.
This is the one place that knows the drawing order of a chart — background, grid, axes, data, guides — and the one place that turns a layout rectangle and a set of scales into actual primitives. Geoms emit their own marks; everything around them is built here.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Draw ¶
Draw lowers c into b. It does not call Flush: the caller owns the backend's lifecycle.
The order is fixed here and nowhere else: background, then every panel's grid and axes, then the titles, then every panel's data inside its own clip, then the guides. Data is drawn after the furniture so that a mark is never hidden by a grid line, and the guides last because they sit outside every panel and must not be clipped by one.
Types ¶
type Chart ¶
type Chart struct {
Width, Height int
DPR float64
Theme theme.Theme
Title string
XTitle string
YTitle string
X, Y scale.Scale
Layers []geom.Geom
// ShowLegend requests a legend. Entries come from the layers.
ShowLegend bool
// Panels, Rows and Cols describe a multi-panel chart: subplots, or the
// facets of one plot. When Panels is empty the chart is the single panel
// described by X, Y and Layers.
Panels []Panel
Rows, Cols int
// Serial draws the panels one at a time. The zero value builds them
// concurrently where that is possible and worth it — see [drawData] — and
// produces the same output either way.
Serial bool
}
Chart is a fully specified chart, ready to be drawn.
type Panel ¶ added in v0.3.0
type Panel struct {
// Row and Col place the panel in the grid.
Row, Col int
// Strip and RightStrip are the labels naming the panel, above it and
// beside it.
Strip, RightStrip string
// X and Y are this panel's scales. Panels sharing an axis share the scale
// object, which is what makes the axis shared rather than merely similar.
X, Y scale.Scale
// Layers are this panel's marks.
Layers []geom.Geom
// ShowX and ShowY report whether this panel writes its own tick labels. A
// panel that shares an axis with its neighbour leaves the labels to the
// edge of the grid.
ShowX, ShowY bool
}
Panel is one Cartesian area of a multi-panel chart.