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 an AxesGraph
will typically result in the X-axis being
set to a BarAxis
, 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 the Series.addMarker
method.
For instance, to display some text above the "Apples" bar in the example above, you
would call something like series.addMarker(new Text("Text", style), 0, 12)
Method Summary |
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 at y=0 . |
BarSeries
public BarSeries(String name)
- Create a new BarSeries
- Parameters:
name
- the name of the series
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 at
y=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
Copyright © 2001-2011 Big Faceless Organization