LineSpec

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.

Parameters

lineColor

the color of the line.

lineThicknessDp

the thickness of the line (in dp).

lineBackgroundShader

an optional DynamicShader to use for the area below the line.

lineCap

the stroke cap for the line.

point

an optional Component that can be drawn at a given point on the line.

pointSizeDp

the size of the point (in dp).

dataLabel

an optional TextComponent to use for data labels.

dataLabelVerticalPosition

the vertical position of data labels relative to the line.

dataLabelValueFormatter

the ValueFormatter to use for data labels.

dataLabelRotationDegrees

the rotation of data labels (in degrees).

pointConnector

the PointConnector for the line.

Constructors

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

Defines the appearance of a line in a line chart.

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

Types

Link copied to clipboard
interface PointConnector

Defines the shape of a line in a line chart by specifying how points are to be connected.

Properties

Link copied to clipboard
Link copied to clipboard

Returns true if the lineBackgroundShader is not null, and false otherwise.

Link copied to clipboard
Link copied to clipboard

The color of the line.

Link copied to clipboard

The stroke cap for the line.

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

Functions

Link copied to clipboard
fun LineChart.LineSpec.copy(lineColor: Int = this.lineColor, lineThicknessDp: Float = this.lineThicknessDp, lineBackgroundShader: DynamicShader? = this.lineBackgroundShader, lineCap: Paint.Cap = this.lineCap, point: Component? = this.point, pointSizeDp: Float = this.pointSizeDp, dataLabel: TextComponent? = this.dataLabel, dataLabelVerticalPosition: VerticalPosition = this.dataLabelVerticalPosition, dataLabelValueFormatter: ValueFormatter = this.dataLabelValueFormatter, dataLabelRotationDegrees: Float = this.dataLabelRotationDegrees, pointConnector: LineChart.LineSpec.PointConnector = this.pointConnector): LineChart.LineSpec

Creates a new LineChart.LineSpec based on this one, updating select properties.

Link copied to clipboard
fun drawBackgroundLine(context: DrawContext, bounds: RectF, path: Path, opacity: Float = 1.0f)

Draws the line background.

Link copied to clipboard
fun drawLine(context: DrawContext, path: Path, opacity: Float = 1.0f)

Draws the line.

Link copied to clipboard
fun drawPoint(context: DrawContext, x: Float, y: Float)

Draws a point at the given x and y coordinates, using the provided context.