Axis
Axis draws an axis along an edge of a CartesianChart instance. There are two built-in implementations: HorizontalAxis and VerticalAxis. Use VerticalAxis.rememberStart, HorizontalAxis.rememberTop, VerticalAxis.rememberEnd, and HorizontalAxis.rememberBottom to instantiate these:
rememberCartesianChart(
startAxis = VerticalAxis.rememberStart(/* ... */),
topAxis = HorizontalAxis.rememberTop(/* ... */),
endAxis = VerticalAxis.rememberEnd(/* ... */),
bottomAxis = HorizontalAxis.rememberBottom(/* ... */),
// ...
)Numerous customization options are available; you can change the appearance of the labels, modify the axis lines, add titles, and more.
BaseAxis.TickPosition and BaseAxis.LineDrawingOrder let you place ticks outside, inside, or across the axis line and choose whether ticks and the axis line are drawn under or over the chart layers.
Titles
BaseAxis.TitlePosition defines where an axis title is drawn. There are two options:
Sideuses the conventional position beside the axis.Endplaces the title at the leading end of the axis line.
Select an option via the titlePosition parameter.
ItemPlacer
HorizontalAxis.ItemPlacer and VerticalAxis.ItemPlacer let you customize for what x- and y-values labels and lines are displayed. Four factory functions are available:
HorizontalAxis.ItemPlacer.aligned(default)VerticalAxis.ItemPlacer.step(default)
Custom implementations can be created.
By default, HorizontalAxis.ItemPlacer.aligned reserves horizontal margins so the extreme labels fit. Set shiftExtremeLabels to true to anchor these labels to the coordinate-system edges instead, keeping them visible without shrinking the coordinate system.
Last updated