-
- All Implemented Interfaces:
-
com.patrykandpatrick.vico.core.chart.Chart,com.patrykandpatrick.vico.core.chart.insets.ChartInsetter,com.patrykandpatrick.vico.core.dimensions.BoundsAware
public class LineChart extends BaseChart<ChartEntryModel>
LineChart displays data as a continuous line.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public classLineChart.LineSpecDefines the appearance of a line in a line chart.
-
Field Summary
Fields Modifier and Type Field Description private final <ERROR CLASS><Float, List<Marker.EntryModel>>entryLocationMapprivate List<LineChart.LineSpec>linesprivate FloatspacingDpprivate AxisPosition.VerticaltargetVerticalAxisPositionprivate final RectFboundsprivate final Collection<ChartInsetter>chartInsettersprivate AxisValuesOverrider<ChartEntryModel>axisValuesOverriderprivate FloatminYprivate FloatmaxYprivate FloatminXprivate FloatmaxX
-
Constructor Summary
Constructors Constructor Description LineChart(LineChart.LineSpec line, Float spacingDp, AxisPosition.Vertical targetVerticalAxisPosition)Creates a LineChart with a common style for all lines. LineChart(List<LineChart.LineSpec> lines, Float spacingDp, AxisPosition.Vertical targetVerticalAxisPosition)
-
Method Summary
Modifier and Type Method Description <ERROR CLASS><Float, List<Marker.EntryModel>>getEntryLocationMap()Links x-axis values to Marker.EntryModels. final List<LineChart.LineSpec>getLines()final UnitsetLines(List<LineChart.LineSpec> lines)final FloatgetSpacingDp()final UnitsetSpacingDp(Float spacingDp)final AxisPosition.VerticalgetTargetVerticalAxisPosition()final UnitsetTargetVerticalAxisPosition(AxisPosition.Vertical targetVerticalAxisPosition)RectFgetBounds()The bounds of the abstract component. Collection<ChartInsetter>getChartInsetters()A Collection of the ChartInsetters that are part of this Chart. AxisValuesOverrider<ChartEntryModel>getAxisValuesOverrider()Overrides the minimum and maximum x-axis and y-axis values. UnitsetAxisValuesOverrider(AxisValuesOverrider<ChartEntryModel> axisValuesOverrider)Overrides the minimum and maximum x-axis and y-axis values. FloatgetMinY()The minimum value shown on the y-axis. UnitsetMinY(@Deprecated(message = Axis values should be overridden via `Chart#axisValuesOverrider`., level = DeprecationLevel.ERROR) Float minY)The minimum value shown on the y-axis. FloatgetMaxY()The maximum value shown on the y-axis. UnitsetMaxY(@Deprecated(message = Axis values should be overridden via `Chart#axisValuesOverrider`., level = DeprecationLevel.ERROR) Float maxY)The maximum value shown on the y-axis. FloatgetMinX()The minimum value shown on the x-axis. UnitsetMinX(@Deprecated(message = Axis values should be overridden via `Chart#axisValuesOverrider`., level = DeprecationLevel.ERROR) Float minX)The minimum value shown on the x-axis. FloatgetMaxX()The maximum value shown on the x-axis. UnitsetMaxX(@Deprecated(message = Axis values should be overridden via `Chart#axisValuesOverrider`., level = DeprecationLevel.ERROR) Float maxX)The maximum value shown on the x-axis. HorizontalDimensionsgetHorizontalDimensions(MeasureContext context, ChartEntryModel model)Called to get the HorizontalDimensions of this chart. UnitupdateChartValues(ChartValuesManager chartValuesManager, ChartEntryModel model, Float xStep)Updates the ChartValues stored in the provided ChartValuesManager instance to this Chart’s ChartValues. UnitgetInsets(MeasureContext context, Insets outInsets, HorizontalDimensions horizontalDimensions)Called during the measurement phase, before getHorizontalInsets. -
Methods inherited from class com.patrykandpatrick.vico.core.chart.line.LineChart
addDecoration, addPersistentMarker, drawNonScrollableContent, drawScrollableContent, removeDecoration, removePersistentMarker, setDecorations, setPersistentMarkers -
Methods inherited from class com.patrykandpatrick.vico.core.chart.BaseChart
removeDecorations -
Methods inherited from class com.patrykandpatrick.vico.core.chart.Chart
getHorizontalInsets, setBounds -
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
-
Constructor Detail
-
LineChart
LineChart(LineChart.LineSpec line, Float spacingDp, AxisPosition.Vertical targetVerticalAxisPosition)
Creates a LineChart with a common style for all lines.- Parameters:
line- a LineSpec 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.
-
LineChart
LineChart(List<LineChart.LineSpec> lines, Float spacingDp, AxisPosition.Vertical targetVerticalAxisPosition)
- 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.
-
-
Method Detail
-
getEntryLocationMap
<ERROR CLASS><Float, List<Marker.EntryModel>> getEntryLocationMap()
Links x-axis values to Marker.EntryModels. A Marker.EntryModel holds the data needed to draw a Marker.
-
getLines
final List<LineChart.LineSpec> getLines()
-
setLines
final Unit setLines(List<LineChart.LineSpec> lines)
-
getSpacingDp
final Float getSpacingDp()
-
setSpacingDp
final Unit setSpacingDp(Float spacingDp)
- Parameters:
spacingDp- the spacing between each LineSpec.point (in dp).
-
getTargetVerticalAxisPosition
final AxisPosition.Vertical getTargetVerticalAxisPosition()
-
setTargetVerticalAxisPosition
final Unit setTargetVerticalAxisPosition(AxisPosition.Vertical targetVerticalAxisPosition)
- Parameters:
targetVerticalAxisPosition- if this is set, any AxisRenderer with an AxisPosition equal to the provided value will use the ChartValues provided by this chart.
-
getChartInsetters
Collection<ChartInsetter> getChartInsetters()
A Collection of the ChartInsetters that are part of this Chart. Each ChartInsetter can influence the final layout of the chart and its components.
-
getAxisValuesOverrider
AxisValuesOverrider<ChartEntryModel> getAxisValuesOverrider()
Overrides the minimum and maximum x-axis and y-axis values. In the case of ColumnCharts and LineCharts contained in ComposedCharts, these overrides can be applied to one vertical axis instead of both. Use ColumnChart.targetVerticalAxisPosition and LineChart.targetVerticalAxisPosition for this purpose.
-
setAxisValuesOverrider
Unit setAxisValuesOverrider(AxisValuesOverrider<ChartEntryModel> axisValuesOverrider)
Overrides the minimum and maximum x-axis and y-axis values. In the case of ColumnCharts and LineCharts contained in ComposedCharts, these overrides can be applied to one vertical axis instead of both. Use ColumnChart.targetVerticalAxisPosition and LineChart.targetVerticalAxisPosition for this purpose.
-
getMinY
Float getMinY()
The minimum value shown on the y-axis. If Model implements ChartEntryModel, and minY is not null, this overrides ChartEntryModel.minY.
-
setMinY
Unit setMinY(@Deprecated(message = Axis values should be overridden via `Chart#axisValuesOverrider`., level = DeprecationLevel.ERROR) Float minY)
The minimum value shown on the y-axis. If Model implements ChartEntryModel, and minY is not null, this overrides ChartEntryModel.minY.
-
getMaxY
Float getMaxY()
The maximum value shown on the y-axis. If Model implements ChartEntryModel, and maxY is not null, this overrides ChartEntryModel.maxY.
-
setMaxY
Unit setMaxY(@Deprecated(message = Axis values should be overridden via `Chart#axisValuesOverrider`., level = DeprecationLevel.ERROR) Float maxY)
The maximum value shown on the y-axis. If Model implements ChartEntryModel, and maxY is not null, this overrides ChartEntryModel.maxY.
-
getMinX
Float getMinX()
The minimum value shown on the x-axis. If Model implements ChartEntryModel, and minX is not null, this overrides ChartEntryModel.minX.
-
setMinX
Unit setMinX(@Deprecated(message = Axis values should be overridden via `Chart#axisValuesOverrider`., level = DeprecationLevel.ERROR) Float minX)
The minimum value shown on the x-axis. If Model implements ChartEntryModel, and minX is not null, this overrides ChartEntryModel.minX.
-
getMaxX
Float getMaxX()
The maximum value shown on the x-axis. If Model implements ChartEntryModel, and maxX is not null, this overrides ChartEntryModel.maxX.
-
setMaxX
Unit setMaxX(@Deprecated(message = Axis values should be overridden via `Chart#axisValuesOverrider`., level = DeprecationLevel.ERROR) Float maxX)
The maximum value shown on the x-axis. If Model implements ChartEntryModel, and maxX is not null, this overrides ChartEntryModel.maxX.
-
getHorizontalDimensions
HorizontalDimensions getHorizontalDimensions(MeasureContext context, ChartEntryModel model)
Called to get the HorizontalDimensions of this chart. The HorizontalDimensions influence the look of various parts of the chart.
- Parameters:
context- holds data used for component measurements.model- holds data about the Chart’s entries.
-
updateChartValues
Unit updateChartValues(ChartValuesManager chartValuesManager, ChartEntryModel model, Float xStep)
Updates the ChartValues stored in the provided ChartValuesManager instance to this Chart’s ChartValues.
- Parameters:
chartValuesManager- the ChartValuesManager whose properties will be updated.model- holds data about the Chart’s entries.xStep- the overridden x step (ornullif no override has occurred).
-
getInsets
Unit getInsets(MeasureContext context, Insets outInsets, 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.
- Parameters:
context- holds data used for the measuring of components.outInsets- used to store the requested insets.horizontalDimensions- the associated Chart’s HorizontalDimensions.
-
-
-
-