org.faceless.graph
Class DepthBarGraph
java.lang.Object
org.faceless.graph.Graph
org.faceless.graph.AxesGraph
org.faceless.graph.AbstractBarGraph
org.faceless.graph.DepthBarGraph
public class DepthBarGraph
- extends AbstractBarGraph
A concrete subclass of AbstractBarGraph that describes Bar Graphs
with X and Z axes - i.e. they go both across and "into" the screen.
By default, Depth Bar graphs turn off the external key by calling
optionDisplayKey(Graph.KEY_NONE)
.
This is because all the information needed
is displayed on the Graph as values on the X and Z axes. If you
would prefer to use the external key rather than put the keys on the Z axis,
set the following options to turn back on the key and turn off the Z-axis
entries:
optionDisplayKey(Graph.KEY_BOXED_BELOW); // or your preference
optionZFormatter(new NullFormatter());
Here's an example showing a simple Depth Bar Graph. The exact same methods
can be used on a Tower Bar Graph for a different view on the data.
import org.faceless.graph.output.ImageOutput;
import java.awt.Color;
// Create a new Bar Graph, and set some options - give
// it a title and make each bar a different color. Also
// give labels to the X and Y axes.
//
DepthBarGraph g = new DepthBarGraph();
g.optionTitle("My First Bar Graph");
g.optionXAxisLabel("Type of Fruit");
g.optionYAxisLabel("Quantity Eaten");
// Add some bars to the graph.
//
g.set("Soursops", "2000", 15);
g.set("Fejoas", "2000", 8);
g.set("Kiwaglis", "2000", 11.7);
g.set("Mangosteens", "2000", 28);
g.set("Soursops", "2001", 7.2);
g.set("Fejoas", "2001", 3);
g.set("Kiwaglis", "2001", 5);
// Mangosteens were off in 2001
// Render to an image that's 400x400
//
ImageOutput out = new ImageOutput(400,400);
out.render(g);
Method Summary |
void |
optionKeyOnX(boolean val)
Whether the X-axis will be the multiple colored one, rather than the Z-axis. |
void |
set(String xset,
String zset,
double val)
Set the value of the specified entry. |
void |
setColor(String set,
Paint color)
Set the color for an entry. |
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 |
DepthBarGraph
public DepthBarGraph()
optionKeyOnX
public void optionKeyOnX(boolean val)
- Whether the X-axis will be the multiple colored one, rather than the Z-axis.
Make sure you set this before adding any data to the set, otherwise
unpredictable results may occur
Default: false
setColor
public void setColor(String set,
Paint color)
- Set the color for an entry.
set
public void set(String xset,
String zset,
double val)
- Set the value of the specified entry.
- Parameters:
xset
- the entry on the X-axis to plot the value againstzset
- the entry on the Z-axis to plot the value againstval
- the value to plot
- Throws:
IllegalArgumentException
- if paramater val is infinite.
Copyright © 2001-2012 Big Faceless Organization