Package 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);
-
-
Field Summary
-
Fields inherited from class org.faceless.graph.AbstractBarGraph
bardepth, barwidth, displayvalue, DISPLAYVALUE_INSIDETOP, DISPLAYVALUE_MIDDLE, DISPLAYVALUE_NONE, DISPLAYVALUE_TOP, maxv, maxx, maxz, minv, minx, minz, roundbars, xkey, ykey, zkey
-
Fields inherited from class org.faceless.graph.AxesGraph
absolutemaxy, absoluteminy, axesmaxx, axesmaxy, axesmaxz, axesminx, axesminy, axesminz, axesstyle, boxstyle, data, xaxeslabelstyle, xaxestextstyle, xfloat, xformatter, xwallstyle, yaxeslabelstyle, yaxestextstyle, yfloat, yformatter, ywallstyle, zaxestextstyle, zfloat, zformatter, zwallstyle
-
Fields inherited from class org.faceless.graph.Graph
canvas, key, KEY_BOXED_BOTTOM, KEY_BOXED_LEFT, KEY_BOXED_RIGHT, KEY_BOXED_TOP, KEY_NONE, keyboxstyle, keypadding, keystyle, keytype, subtitle, subtitlestyle, title, titlepadding, titlestyle, xrotation, yrotation, zrotation
-
-
Constructor Summary
Constructors Constructor Description DepthBarGraph()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
optionKeyOnX(boolean val)
Whether the X-axis will be the multiple colored one, rather than the Z-axis.protected void
plotBar(int ix, int iy, int iz, double endval)
Needs to be completed by concrete subclasses of this class.void
set(java.lang.String xset, java.lang.String zset, double val)
Set the value of the specified entry.void
setColor(java.lang.String set, java.awt.Paint color)
Set the color for an entry.-
Methods inherited from class org.faceless.graph.AbstractBarGraph
complete, getBoxElement, optionBarDepth, optionBarWidth, optionDisplayValue, optionRoundBars, optionXStretchToZero, optionYStretchToZero, plotBarValue, postcomplete, prescalecomplete
-
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, postpostcomplete
-
Methods inherited from class org.faceless.graph.Graph
addElement, getDefaultBorderColor, getFontScale, optionDisplayKey, optionFixedAspectRatio, optionKeyBoxStyle, optionKeyStyle, optionRemoveBackFace, optionSubTitle, optionSubTitleStyle, optionTitle, optionTitleStyle, optionXRotation, optionYRotation, optionZRotation, setDefaultBorderColor, setDefaultColors, setDefaultLineThickness, setFontScale, setLicenseKey, setLightLevel, setLightVector, setPieEdgeDegrees, toCanvas
-
-
-
-
Method Detail
-
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 occurDefault: false
-
setColor
public void setColor(java.lang.String set, java.awt.Paint color)
Set the color for an entry.
-
set
public void set(java.lang.String xset, java.lang.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:
java.lang.IllegalArgumentException
- if paramater val is infinite.
-
plotBar
protected void plotBar(int ix, int iy, int iz, double endval)
Description copied from class:AbstractBarGraph
Needs to be completed by concrete subclasses of this class.- Specified by:
plotBar
in classAbstractBarGraph
- Parameters:
ix
- The X position of this valueiy
- The Y position of this valueiz
- The Z position of this valueendval
- The value to plot.
-
-