-
- All Implemented Interfaces:
-
com.patrykandpatrick.vico.core.chart.Chart,com.patrykandpatrick.vico.core.chart.insets.ChartInsetter,com.patrykandpatrick.vico.core.dimensions.BoundsAware
public class ColumnChart extends BaseChart<ChartEntryModel>
ColumnChart displays data as vertical bars. It can group and stack columns.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public enumColumnChart.MergeModeDefines how a ColumnChart should draw columns in column collections.
-
Field Summary
Fields Modifier and Type Field Description private final <ERROR CLASS><Float, List<Marker.EntryModel>>entryLocationMapprivate List<LineComponent>columnsprivate FloatspacingDpprivate FloatinnerSpacingDpprivate ColumnChart.MergeModemergeModeprivate AxisPosition.VerticaltargetVerticalAxisPositionprivate TextComponentdataLabelprivate VerticalPositiondataLabelVerticalPositionprivate ValueFormatterdataLabelValueFormatterprivate FloatdataLabelRotationDegreesprivate final RectFboundsprivate final Collection<ChartInsetter>chartInsettersprivate AxisValuesOverrider<ChartEntryModel>axisValuesOverriderprivate FloatminYprivate FloatmaxYprivate FloatminXprivate FloatmaxX
-
Constructor Summary
Constructors Constructor Description ColumnChart(LineComponent column, Float spacingDp, AxisPosition.Vertical targetVerticalAxisPosition)Creates a ColumnChart with a common style for all columns. ColumnChart()Creates a ColumnChart instance with columns set to an empty list. ColumnChart(List<LineComponent> columns, Float spacingDp, Float innerSpacingDp, ColumnChart.MergeMode mergeMode, AxisPosition.Vertical targetVerticalAxisPosition, TextComponent dataLabel, VerticalPosition dataLabelVerticalPosition, ValueFormatter dataLabelValueFormatter, Float dataLabelRotationDegrees)
-
Method Summary
Modifier and Type Method Description <ERROR CLASS><Float, List<Marker.EntryModel>>getEntryLocationMap()Links x-axis values to Marker.EntryModels. final List<LineComponent>getColumns()final UnitsetColumns(List<LineComponent> columns)final FloatgetSpacingDp()final UnitsetSpacingDp(Float spacingDp)final FloatgetInnerSpacingDp()final UnitsetInnerSpacingDp(Float innerSpacingDp)final ColumnChart.MergeModegetMergeMode()final UnitsetMergeMode(ColumnChart.MergeMode mergeMode)final AxisPosition.VerticalgetTargetVerticalAxisPosition()final UnitsetTargetVerticalAxisPosition(AxisPosition.Vertical targetVerticalAxisPosition)final TextComponentgetDataLabel()final UnitsetDataLabel(TextComponent dataLabel)final VerticalPositiongetDataLabelVerticalPosition()final UnitsetDataLabelVerticalPosition(VerticalPosition dataLabelVerticalPosition)final ValueFormattergetDataLabelValueFormatter()final UnitsetDataLabelValueFormatter(ValueFormatter dataLabelValueFormatter)final FloatgetDataLabelRotationDegrees()final UnitsetDataLabelRotationDegrees(Float dataLabelRotationDegrees)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. UnitupdateChartValues(ChartValuesManager chartValuesManager, ChartEntryModel model, Float xStep)Updates the ChartValues stored in the provided ChartValuesManager instance to this Chart’s ChartValues. HorizontalDimensionsgetHorizontalDimensions(MeasureContext context, ChartEntryModel model)Called to get the HorizontalDimensions of this chart. -
Methods inherited from class com.patrykandpatrick.vico.core.chart.column.ColumnChart
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, getInsets, setBounds -
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
-
Constructor Detail
-
ColumnChart
ColumnChart(LineComponent column, Float spacingDp, AxisPosition.Vertical targetVerticalAxisPosition)
Creates a ColumnChart with a common style for all columns.- Parameters:
column- a LineComponent defining the appearance of the columns.spacingDp- the distance between neighboring column collections.targetVerticalAxisPosition- if this is set, any AxisRenderer with an AxisPosition equal to the provided value will use the ChartValues provided by this chart.
-
ColumnChart
ColumnChart()
Creates a ColumnChart instance with columns set to an empty list.
-
ColumnChart
ColumnChart(List<LineComponent> columns, Float spacingDp, Float innerSpacingDp, ColumnChart.MergeMode mergeMode, AxisPosition.Vertical targetVerticalAxisPosition, TextComponent dataLabel, VerticalPosition dataLabelVerticalPosition, ValueFormatter dataLabelValueFormatter, Float dataLabelRotationDegrees)
- Parameters:
columns- the LineComponent instances to use for columns.spacingDp- the distance between neighboring column collections.innerSpacingDp- the distance between neighboring grouped columns.mergeMode- defines how columns should be drawn in column collections.targetVerticalAxisPosition- if this is set, any AxisRenderer with an AxisPosition equal to the provided value will use the ChartValues provided by this chart.dataLabel- an optional TextComponent to use for data labels.dataLabelVerticalPosition- the vertical position of data labels relative to the top of their respective columns.dataLabelValueFormatter- the ValueFormatter to use for data labels.dataLabelRotationDegrees- the rotation of data labels (in degrees).
-
-
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.
-
getColumns
final List<LineComponent> getColumns()
-
setColumns
final Unit setColumns(List<LineComponent> columns)
- Parameters:
columns- the LineComponent instances to use for columns.
-
getSpacingDp
final Float getSpacingDp()
-
setSpacingDp
final Unit setSpacingDp(Float spacingDp)
- Parameters:
spacingDp- the distance between neighboring column collections.
-
getInnerSpacingDp
final Float getInnerSpacingDp()
-
setInnerSpacingDp
final Unit setInnerSpacingDp(Float innerSpacingDp)
- Parameters:
innerSpacingDp- the distance between neighboring grouped columns.
-
getMergeMode
final ColumnChart.MergeMode getMergeMode()
-
setMergeMode
final Unit setMergeMode(ColumnChart.MergeMode mergeMode)
- Parameters:
mergeMode- defines how columns should be drawn in column collections.
-
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.
-
getDataLabel
final TextComponent getDataLabel()
-
setDataLabel
final Unit setDataLabel(TextComponent dataLabel)
- Parameters:
dataLabel- an optional TextComponent to use for data labels.
-
getDataLabelVerticalPosition
final VerticalPosition getDataLabelVerticalPosition()
-
setDataLabelVerticalPosition
final Unit setDataLabelVerticalPosition(VerticalPosition dataLabelVerticalPosition)
- Parameters:
dataLabelVerticalPosition- the vertical position of data labels relative to the top of their respective columns.
-
getDataLabelValueFormatter
final ValueFormatter getDataLabelValueFormatter()
-
setDataLabelValueFormatter
final Unit setDataLabelValueFormatter(ValueFormatter dataLabelValueFormatter)
- Parameters:
dataLabelValueFormatter- the ValueFormatter to use for data labels.
-
getDataLabelRotationDegrees
final Float getDataLabelRotationDegrees()
-
setDataLabelRotationDegrees
final Unit setDataLabelRotationDegrees(Float dataLabelRotationDegrees)
- Parameters:
dataLabelRotationDegrees- the rotation of data labels (in degrees).
-
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.
-
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).
-
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.
-
-
-
-