Package org.faceless.graph2
Class BarSeries
- java.lang.Object
-
- org.faceless.graph2.Series
-
- org.faceless.graph2.GeneralBarSeries
-
- org.faceless.graph2.BarSeries
-
public class BarSeries extends GeneralBarSeries
The most basic form of Bar series, this can be used to plot bars to a graph like so:AxesGraph graph = new AxesGraph(); BarSeries series = new BarSeries("Fruit"); series.set("Apples", 10); series.set("Oranges", 13); graph.addSeries(series);
Adding a BarSeries to anAxesGraph
will typically result in the X-axis being set to aBarAxis
, and the default ordering of the bars is the order they're added to the Series.Internally values in a Bar Series are treated as numbers, the same as all the other series. So, for instance, in the example above "Apples" is 0 and "Oranges" is 1. Then the
BarAxis
formats those numbers to display the correct text. This becomes important to know when adding Markers to the graph using theSeries.addMarker
method. For instance, to display some text above the "Apples" bar in the example above, you would call something likeseries.addMarker(new Text("Text", style), 0, 12)
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
set(String name, double height)
Add a bar to the series.void
set(String name, double min, double max)
Add a bar to the series, which does not necessarily have to start aty=0
.-
Methods inherited from class org.faceless.graph2.GeneralBarSeries
addMarker, setBarDepth, setBarLabels, setBarWidth, setBarWidth, setBarWidth, setRoundBars, setRoundBars, setStyle
-
Methods inherited from class org.faceless.graph2.Series
addBox, addLine, addMarker, getName, outputToSeries, outputToSeriesFunction, setStyle, toString
-
-
-
-
Constructor Detail
-
BarSeries
public BarSeries(String name)
Create a new BarSeries- Parameters:
name
- the name of the series
-
-
Method Detail
-
set
public void set(String name, double height)
Add a bar to the series. If the BarSeries already contains a bar with that series in it, it's value will be overwritten. If you really need two bars with the same name on the series you can add a space to the end of the name, eg.barseries.set("Apples", 10); barseries.set("Apples ", 10);
- Parameters:
name
- the name of the barheight
- the value of the bar
-
set
public void set(String name, double min, double max)
Add a bar to the series, which does not necessarily have to start aty=0
. This can be used to create "floating" bars.- Parameters:
name
- the name of the barmin
- the bottom-most Y co-ordinate of the barmax
- the top-most Y co-ordinate of the bar
-
-