LineChart

open class LineChart(var lines: List<LineChart.LineSpec> = listOf(LineSpec()), var spacingDp: Float = DefaultDimens.POINT_SPACING, var targetVerticalAxisPosition: AxisPosition.Vertical? = null, var drawingModelInterpolator: DrawingModelInterpolator<LineChartDrawingModel.PointInfo, LineChartDrawingModel> = DefaultDrawingModelInterpolator()) : BaseChart<ChartEntryModel>

LineChart displays data as a continuous line.

Parameters

lines

a List of LineSpecs defining the style of each line.

spacingDp

the spacing between each LineSpec.point (in dp).

targetVerticalAxisPosition

if this is set, any AxisRenderer with an AxisPosition equal to the provided value will use the ChartValues provided by this chart. This is meant to be used with ComposedChart.

drawingModelInterpolator

interpolates the LineChart’s LineChartDrawingModels.

Constructors

Link copied to clipboard
constructor(line: LineChart.LineSpec, spacingDp: Float, targetVerticalAxisPosition: AxisPosition.Vertical? = null)

Creates a LineChart with a common style for all lines.

constructor(lines: List<LineChart.LineSpec> = listOf(LineSpec()), spacingDp: Float = DefaultDimens.POINT_SPACING, targetVerticalAxisPosition: AxisPosition.Vertical? = null, drawingModelInterpolator: DrawingModelInterpolator<LineChartDrawingModel.PointInfo, LineChartDrawingModel> = DefaultDrawingModelInterpolator())

Types

Link copied to clipboard
open class LineSpec(lineColor: Int = Color.LTGRAY, var lineThicknessDp: Float = DefaultDimens.LINE_THICKNESS, var lineBackgroundShader: DynamicShader? = null, var lineCap: Paint.Cap = Paint.Cap.ROUND, var point: Component? = null, var pointSizeDp: Float = DefaultDimens.POINT_SIZE, var dataLabel: TextComponent? = null, var dataLabelVerticalPosition: VerticalPosition = VerticalPosition.Top, var dataLabelValueFormatter: ValueFormatter = DecimalFormatValueFormatter(), var dataLabelRotationDegrees: Float = 0.0f, var pointConnector: LineChart.LineSpec.PointConnector = DefaultPointConnector())

Defines the appearance of a line in a line chart.

Properties

Link copied to clipboard

Links x-axis values to Marker.EntryModels. A Marker.EntryModel holds the data needed to draw a Marker.

Link copied to clipboard
Link copied to clipboard

Provides the Chart’s ModelTransformer.

Link copied to clipboard

Functions

Link copied to clipboard
open override fun getInsets(context: MeasureContext, outInsets: Insets, horizontalDimensions: HorizontalDimensions)

Called during the measurement phase, before getHorizontalInsets. Both horizontal and vertical insets can be requested from this function. The final inset for a given edge of the associated Chart is the largest of the insets requested for the edge.

Link copied to clipboard
open override fun updateChartValues(chartValuesManager: ChartValuesManager, model: ChartEntryModel, xStep: Float?)

Updates the ChartValues stored in the provided ChartValuesManager instance to this Chart’s ChartValues.

Link copied to clipboard
open override fun updateHorizontalDimensions(context: MeasureContext, horizontalDimensions: MutableHorizontalDimensions, model: ChartEntryModel)

Updates the chart’s MutableHorizontalDimensions instance.