CategoryAxisModel

class CategoryAxisModel<T>(categories: List<T>, val minimumMajorTickSpacing: Dp = 50.dp) : AxisModel<T>

An axis that uses arbitrary category objects instead of numbers as its values. It is a discrete axis.

Parameters

T

The data type of the axis values.

categories

The objects that represent values on this axis. If objects are duplicated as defined by their equals method, the behavior is undefined.

Constructors

Link copied to clipboard
fun <T> CategoryAxisModel(categories: List<T>, minimumMajorTickSpacing: Dp = 50.dp)

Functions

Link copied to clipboard
open override fun computeOffset(point: T): Float

Returns the offset of the provided string within this Category axis. Returns NaN if point is not a valid category.

Link copied to clipboard
open override fun computeTickValues(axisLength: Dp): TickValues<T>

Computes major and minor tick values based on the minimum tick spacing and the overall axisLength.

Link copied to clipboard
open fun pan(amount: Float)

Asks the AxisState to compute new ranges and tick values after panning, if the axis supports panning.

Link copied to clipboard
open fun zoom(zoomFactor: Float, pivot: Float)

Asks the AxisState to compute new ranges and tick values after zooming, if the axis supports zooming.

Properties

Link copied to clipboard
open override val minimumMajorTickSpacing: Dp

Specifies the minimum spacing for major ticks, in Dp units. Must be greater than 0.