Package org.faceless.graph
Class BarGraph
- java.lang.Object
-
- org.faceless.graph.Graph
-
- org.faceless.graph.AxesGraph
-
- org.faceless.graph.AbstractBarGraph
-
- org.faceless.graph.BarGraph
-
public class BarGraph extends AbstractBarGraph
A concrete subclass of AbstractBarGraph that handles the simplest type of Bar Graph - a single row of bars, running across the X axis.
By Default, the
BarGraph
turns off the external key by callingoptionDisplayKey(Graph.KEY_NONE)
. This is because all the information required is displayed on the axes of the Graph.Here's an example showing a simple BarGraph.
import org.faceless.graph.output.ImageOutput; import java.awt.Color; // Create a new Bar Graph, and set some options. // BarGraph g = new BarGraph(); optionTitle("My First Bar Graph"); optionXAxisLabel("Type of Fruit"); optionYAxisLabel("Quantity Eaten"); // Add some bars to the graph. Compare something // other than apples and oranges for a change. // g.set("Pomegranites", 20); g.set("Soursops", 15); g.set("Fejoas", 8); g.set("Kumquats", 9.5); g.set("Kiwaglis", 11.7); g.set("Tamarillos", 28); g.set("Mangosteens", 28); // 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 BarGraph()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description 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 set, double val)
Set the value of the specified entryvoid
setColor(java.lang.String set, java.awt.Paint color)
Set the color of 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
-
setColor
public void setColor(java.lang.String set, java.awt.Paint color)
Set the color of an entry
-
set
public void set(java.lang.String set, double val)
Set the value of the specified entry
- Parameters:
set
- the entry on the X-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.
-
-