Skip to main content
Version: 2.0.0-beta.2

Axes

You can display an axis along each of the four edges of a CartesianChart. There are two axes: HorizontalAxis and VerticalAxis. Numerous customization options are available—you can change the appearance of the labels, modify the axis lines, add titles, and more.

The itemPlacer parameters and properties let you apply HorizontalAxis.ItemPlacer and VerticalAxis.ItemPlacer instances, enabling you to customize for what x and y values labels and lines are displayed. Four factory functions are available:

Custom implementations can be created.

tip

For information on x and y range customization, see the CartesianLayerRangeProvider section of the CartesianLayer introduction page.

Use the VerticalAxis.rememberStart, HorizontalAxis.rememberTop, VerticalAxis.rememberEnd, and HorizontalAxis.rememberBottom functions to create axes:

CartesianChartHost(
chart = rememberCartesianChart(
startAxis = VerticalAxis.rememberStart(...),
topAxis = HorizontalAxis.rememberTop(...),
endAxis = VerticalAxis.rememberEnd(...),
bottomAxis = HorizontalAxis.rememberBottom(...),
...
),
...
)

For the label, axis, tick, and guideline parameters of these functions, you can use rememberAxisLabelComponent, rememberAxisLineComponent, rememberAxisTickComponent, and rememberAxisGuidelineComponent, which have more suitable defaults than rememberTextComponent and rememberLineComponent.