Package limn.components.chart
Class ChartSeries
java.lang.Object
limn.components.chart.ChartSeries
One named run of values: a bar series, a line, or (in a
DonutChart) the ring
itself. The values are indexed against the chart's
labels: value i belongs to category
i, and a series shorter than the label list simply has no value for the
categories past its end.
Double.NaN is a gap, not a zero: a line breaks across it and a bar is
not drawn for it. That is the difference between "we measured nothing" and "we measured
zero", and the two must not look the same.
Every setter here reaches back into the chart holding the series, so changing a series after the chart is on screen animates and repaints exactly like changing it through the chart. UI thread only, like every other widget mutation.
ChartSeries revenue = ChartSeries.of("Revenue", 12, 19, 3, 5)
.setStack("2026") // bar: which stack this belongs to
.setFilled(true); // line: fill the area under it
-
Method Summary
Modifier and TypeMethodDescriptioncolor()The color the application pinned, ornullwhile the palette decides.booleanisFilled()Whether aLineChartfills the area under this line.booleanisSmooth()Whether aLineChartdraws this series as a curve rather than as segments.booleanWhether this series is drawn; the legend toggles it.floatLine thickness in logical points (default 2).name()The name as it currently reads, in the legend and in tooltip rows.The localizable value behindname(), which a language change re-resolves.static ChartSeriesA series namednameovervalues.static ChartSeriesof(I18nString name, double... values) A series whose name follows the UI language; seeI18nString.floatMarker radius in logical points;0draws no markers (default 3).Pins this series' color;nullhands it back to the chart's palette.setFilled(boolean value) Fills the area between this line and the baseline with a fade of its own color.setLineWidth(float value) Sets the line thickness in logical points.Renames the series.setName(I18nString value) Renames the series with a value that follows the UI language.setPointRadius(float value) Sets the marker radius in logical points (0hides the markers).setSmooth(boolean value) Draws the line as a curve through its points.Sets the stack key.setValues(double... newValues) Replaces the values.setVisible(boolean value) Shows or hides the series.intsize()How many values this series carries.stack()The stack this series belongs to in a stacked bar chart, or in a stacked line chart.doublevalue(int index) The value atindex, orDouble.NaNwhen the series is shorter than that, which reads as a gap, exactly like an explicit NaN.double[]values()The values, copied.
-
Method Details
-
of
A series namednameovervalues. -
of
A series whose name follows the UI language; seeI18nString. -
name
The name as it currently reads, in the legend and in tooltip rows. -
nameSource
The localizable value behindname(), which a language change re-resolves. -
setName
Renames the series. -
setName
Renames the series with a value that follows the UI language. -
size
public int size()How many values this series carries. -
value
public double value(int index) The value atindex, orDouble.NaNwhen the series is shorter than that, which reads as a gap, exactly like an explicit NaN. -
values
public double[] values()The values, copied. -
setValues
Replaces the values. The chart animates from what is currently drawn to the new numbers, so a live series can be re-pushed as often as its data arrives. -
color
The color the application pinned, ornullwhile the palette decides. -
setColor
Pins this series' color;nullhands it back to the chart's palette. -
stack
The stack this series belongs to in a stacked bar chart, or in a stacked line chart. Series sharing a key stack on top of each other; different keys stand side by side. Default"": one stack for everything. -
setStack
Sets the stack key. -
isVisible
public boolean isVisible()Whether this series is drawn; the legend toggles it. -
setVisible
Shows or hides the series. The marks fade out and, in a stacked chart, the stack re-flows around them; the scale is recomputed from what is left. -
isFilled
public boolean isFilled()Whether aLineChartfills the area under this line. -
setFilled
Fills the area between this line and the baseline with a fade of its own color. -
isSmooth
public boolean isSmooth()Whether aLineChartdraws this series as a curve rather than as segments. -
setSmooth
Draws the line as a curve through its points. Off by default: a curve invents intermediate values the data never had, which is fine for a trend and wrong for a measurement the reader may try to read off the chart. -
lineWidth
public float lineWidth()Line thickness in logical points (default 2). -
setLineWidth
Sets the line thickness in logical points. -
pointRadius
public float pointRadius()Marker radius in logical points;0draws no markers (default 3). -
setPointRadius
Sets the marker radius in logical points (0hides the markers).
-