Axis

Overview

Axisarrow-up-right draws an axis along one of a CartesianChartarrow-up-right’s edges. There are two built-in implementations: HorizontalAxisarrow-up-right and VerticalAxisarrow-up-right. Numerous customization options are available—you can change the appearance of the labels, modify the axis lines, add titles, and more.

Use the XML attributes to create HorizontalAxisarrow-up-right and VerticalAxisarrow-up-right instances:

<style name="ChartStyle">
    <item name="showStartAxis">true</item>
    <item name="showTopAxis">true</item>
    <item name="showEndAxis">true</item>
    <item name="showBottomAxis">true</item>
</style>
<com.patrykandpatrick.vico.views.cartesian.CartesianChartView
    app:chartStyle="@style/ChartStyle"
    <!-- ... --> />

Alternatively, use VerticalAxis.startarrow-up-right, HorizontalAxis.toparrow-up-right, VerticalAxis.endarrow-up-right, and HorizontalAxis.bottomarrow-up-right:

cartesianChartView.chart =
    CartesianChart(
        startAxis = VerticalAxis.start(/* ... */),
        topAxis = HorizontalAxis.top(/* ... */),
        endAxis = VerticalAxis.end(/* ... */),
        bottomAxis = HorizontalAxis.bottom(/* ... */),
        // ...
    )

ItemPlacer

HorizontalAxis.ItemPlacerarrow-up-right and VerticalAxis.ItemPlacerarrow-up-right let you customize for what x- and y-values labels and lines are displayed. Four factory functions are available:

Custom implementations can be created.

Sample charts

Last updated