org.faceless.graph
Class FloatingBarGraph
java.lang.Object
org.faceless.graph.Graph
org.faceless.graph.AxesGraph
org.faceless.graph.AbstractBarGraph
org.faceless.graph.FloatingBarGraph
public class FloatingBarGraph
- extends AbstractBarGraph
A type of Bar graph where the bars float above the axis. It's
used to show a range of values, with the average, median or some
other value in the middle. The graph only extends along the X axis
(i.e. it has no depth).
There are two datasets defined, called MIN
and
MAX
(for the bottom and top parts of the bar). You can
change the colors of these sets with setColor("MIN", color)
Here's an example showing a simple FloatingBarGraph
.
import org.faceless.graph.output.ImageOutput;
import java.awt.Color;
// Create a new Floating Bar Graph and
// set the color of the bars.
//
FloatingBarGraph g = new FloatingBarGraph();
g.optionTitle("My First Floating Bar Graph");
g.setColor("MIN", Color.yellow);
g.setColor("MAX", Color.green);
// Add some bars to the graph. The averages
// in this example aren't very useful...
//
g.set("Cabbages", 10, (10+18)/2, 18);
g.set("Cauliflower", 12, (12+19)/2, 19);
g.set("Courgettes", 11, (11+15)/2, 15);
// Render to an image that's 400x400
//
ImageOutput out = new ImageOutput(400,400);
out.render(g);
Method Summary |
void |
set(String xset,
double min,
double center,
double max)
Add a bar with the specified bottom, middle and top values. |
void |
setColor(String name,
Paint color)
Set the color of a dataset. |
Methods inherited from class org.faceless.graph.AxesGraph |
optionAxisStyle, optionBoxColor, optionFloorStyle, optionMaxY, optionMinY, optionXAxisAtZero, optionXAxisLabel, optionXAxisLabelStyle, optionXAxisStyle, optionXAxisTextRotation, optionXFormatter, optionYAxisAtZero, optionYAxisLabel, optionYAxisLabelStyle, optionYAxisStyle, optionYAxisTextRotation, optionYFormatter, optionYWallStyle, optionZAxisStyle, optionZFormatter, optionZWallStyle |
Methods inherited from class org.faceless.graph.Graph |
getDefaultBorderColor, getFontScale, optionDisplayKey, optionFixedAspectRatio, optionKeyBoxStyle, optionKeyStyle, optionSubTitle, optionSubTitleStyle, optionTitle, optionTitleStyle, optionXRotation, optionYRotation, optionZRotation, setDefaultBorderColor, setDefaultColors, setDefaultLineThickness, setFontScale, setLicenseKey, setLightLevel, setLightVector, setPieEdgeDegrees, toCanvas |
FloatingBarGraph
public FloatingBarGraph()
set
public void set(String xset,
double min,
double center,
double max)
- Add a bar with the specified bottom, middle and top values.
- Parameters:
xset
- The data set on the X axis. If it doesn't exist, it's created.min
- The Y axis value for the bottom of the barcenter
- The value at which to end the bottom half and start the top half of the barmax
- The Y axis value for the top of the bar
- Throws:
IllegalArgumentException
- If paramaters min, max or center are infite.
setColor
public void setColor(String name,
Paint color)
- Set the color of a dataset. The set must
be either MIN or MAX, otherwise an
IllegalArgumentException
is thrown.
- Parameters:
name
- the name of the dataset, either MIN or MAXcolor
- the color to set this dataset to.
Copyright © 2001-2012 Big Faceless Organization