MeasureContext

MeasureContext holds data used by various chart components during the measuring and drawing phases.

Inheritors

Properties

Link copied to clipboard
abstract val canvasBounds: RectF

The bounds of the canvas that will be used to draw the chart and its components.

Link copied to clipboard

Provides the chart’s ChartValues instances.

Link copied to clipboard
abstract val density: Float

The pixel density.

Link copied to clipboard

Defines how the chart’s content is positioned horizontally.

Link copied to clipboard

Whether horizontal scrolling is enabled.

Link copied to clipboard
abstract val isLtr: Boolean

Whether the layout direction is left-to-right.

Link copied to clipboard

A multiplier used to ensure support for both left-to-right and right-to-left layouts. Values such as translation deltas are multiplied by this value. layoutDirectionMultiplier is equal to 1f if isLtr is true, and -1f otherwise.

Link copied to clipboard
open val Float.pixels: Float

The number of pixels corresponding to this number of density-independent pixels.

Link copied to clipboard

The number of pixels corresponding to this number of density-independent pixels, with decimal values discarded.

Functions

Link copied to clipboard
open fun dpToPx(dp: Float): Float

Converts the provided dimension from dp to px.

Link copied to clipboard
fun MeasureContext.getAutoZoom(horizontalDimensions: HorizontalDimensions, chartBounds: RectF, autoScaleUp: AutoScaleUp): Float

Returns the automatic zoom factor for a chart.

Link copied to clipboard
fun MeasureContext.getMaxScrollDistance(chartWidth: Float, horizontalDimensions: HorizontalDimensions, zoom: Float? = null): Float

Returns the maximum scroll distance.

Link copied to clipboard
abstract fun reset()

Removes all stored extras.

Link copied to clipboard
abstract fun spToPx(sp: Float): Float

Converts the provided dimension from sp to px.

Link copied to clipboard
open fun toFontSize(sp: Float): Float

Converts the provided dimension from sp to px.

Link copied to clipboard
open fun toPixels(dp: Float): Float

Converts the provided dimension from dp to px.