Package org.faceless.graph
Class AbstractBarGraph
- java.lang.Object
-
- org.faceless.graph.Graph
-
- org.faceless.graph.AxesGraph
-
- org.faceless.graph.AbstractBarGraph
-
- Direct Known Subclasses:
BarGraph
,DepthBarGraph
,FloatingBarGraph
,MultiBarGraph
,TowerBarGraph
public abstract class AbstractBarGraph extends AxesGraph
An abstract superclass for all Bar Graphs. Takes care of some of the work to do with laying out bars. Subclasses of this class need to implement the
plotBar
method
-
-
Field Summary
Fields Modifier and Type Field Description protected double
bardepth
protected double
barwidth
protected int
displayvalue
static int
DISPLAYVALUE_INSIDETOP
Value tooptionDisplayValue(int)
to display the value at the end, but just inside the barstatic int
DISPLAYVALUE_MIDDLE
Value tooptionDisplayValue(int)
to display the value in the middle of the barstatic int
DISPLAYVALUE_NONE
Value tooptionDisplayValue(int)
to not display the value on the bar (the default)static int
DISPLAYVALUE_TOP
Value tooptionDisplayValue(int)
to display the value above the barprotected double
maxv
protected double
maxx
protected double
maxz
protected double
minv
protected double
minx
protected double
minz
protected boolean
roundbars
protected org.faceless.graph.Key
xkey
protected org.faceless.graph.Key
ykey
protected org.faceless.graph.Key
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 Modifier Constructor Description protected
AbstractBarGraph()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected void
complete()
This method takes care of most of the work to plot BarGraphs.protected org.faceless.graph.Element
getBoxElement(java.lang.String name, Point p1, Point p2, Style style)
void
optionBarDepth(double val)
How deep to make each bar, as a proportion of the square it rests onvoid
optionBarWidth(double val)
How wide to make each bar, as a proportion of the square it rests onvoid
optionDisplayValue(int pos)
Whether to display the value for the bar directly on the graph.void
optionRoundBars(boolean round)
Whether to draw the bars in the graph as cylinders instead of the default rectangles.void
optionXStretchToZero(boolean val)
Cannot be set by the user for this class and it's subclasses.void
optionYStretchToZero(boolean val)
Cannot be set by the user for this class and it's subclasses.protected abstract void
plotBar(int ix, int iy, int iz, double val)
Needs to be completed by concrete subclasses of this class.protected void
plotBarValue(Point p1, Point p2, double val)
protected void
postcomplete()
PostComplete is called by a Graph when it's rendered, but after complete.protected void
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
-
-
-
-
Field Detail
-
DISPLAYVALUE_NONE
public static final int DISPLAYVALUE_NONE
Value tooptionDisplayValue(int)
to not display the value on the bar (the default)- See Also:
- Constant Field Values
-
DISPLAYVALUE_MIDDLE
public static final int DISPLAYVALUE_MIDDLE
Value tooptionDisplayValue(int)
to display the value in the middle of the bar- See Also:
- Constant Field Values
-
DISPLAYVALUE_TOP
public static final int DISPLAYVALUE_TOP
Value tooptionDisplayValue(int)
to display the value above the bar- See Also:
- Constant Field Values
-
DISPLAYVALUE_INSIDETOP
public static final int DISPLAYVALUE_INSIDETOP
Value tooptionDisplayValue(int)
to display the value at the end, but just inside the bar- Since:
- 1.1
- See Also:
- Constant Field Values
-
barwidth
protected double barwidth
-
bardepth
protected double bardepth
-
xkey
protected org.faceless.graph.Key xkey
-
ykey
protected org.faceless.graph.Key ykey
-
zkey
protected org.faceless.graph.Key zkey
-
minx
protected double minx
-
maxx
protected double maxx
-
minz
protected double minz
-
maxz
protected double maxz
-
maxv
protected double maxv
-
minv
protected double minv
-
displayvalue
protected int displayvalue
-
roundbars
protected boolean roundbars
-
-
Method Detail
-
optionBarWidth
public void optionBarWidth(double val)
How wide to make each bar, as a proportion of the square it rests onDefault: 1.0
-
optionBarDepth
public void optionBarDepth(double val)
How deep to make each bar, as a proportion of the square it rests onDefault: 1.0
-
optionDisplayValue
public void optionDisplayValue(int pos)
Whether to display the value for the bar directly on the graph. One ofDISPLAYVALUE_NONE
to not display the value,DISPLAYVALUE_MIDDLE
to display the value in the middle of the bar,DISPLAYVALUE_TOP
to display the value above the bar, orDISPLAYVALUE_INSIDETOP
to display the value at the end of but just inside the bar.Default: DISPLAYVALUE_NONE
- Since:
- 1.0.7
-
optionRoundBars
public void optionRoundBars(boolean round)
Whether to draw the bars in the graph as cylinders instead of the default rectangles. The diameter of the cylinder is the average of the bar-depth and the bar-width. This value may be ignored by some subclasses (currently only MultiBarGraph).
Drawing cylinders is considerably slower than drawing rectangles. This can be sped up by reducing the number of flat edges used to draw the cylinder, by passing a higher value to the
Graph.setPieEdgeDegrees(double)
method. The default for Bar Graphs is 10.- Since:
- 1.0.10
-
optionXStretchToZero
public void optionXStretchToZero(boolean val)
Cannot be set by the user for this class and it's subclasses. Will always throw an exception.- Overrides:
optionXStretchToZero
in classAxesGraph
- Throws:
java.lang.UnsupportedOperationException
-
optionYStretchToZero
public void optionYStretchToZero(boolean val)
Cannot be set by the user for this class and it's subclasses. Will always throw an exception.- Overrides:
optionYStretchToZero
in classAxesGraph
- Throws:
java.lang.UnsupportedOperationException
-
complete
protected void complete()
This method takes care of most of the work to plot BarGraphs. It cycles through all the data values and calls plotBar to actually draw the data.
-
postcomplete
protected void postcomplete()
Description copied from class:Graph
PostComplete is called by a Graph when it's rendered, but after complete. It should add any elements that are required but couldn't be calculated until afterGraph.complete()
(the axes in an axes graph are an example). The last thing it should do before returning is callsuper.postcomplete()
- Overrides:
postcomplete
in classAxesGraph
-
prescalecomplete
protected void prescalecomplete()
- Overrides:
prescalecomplete
in classAxesGraph
-
plotBar
protected abstract void plotBar(int ix, int iy, int iz, double val)
Needs to be completed by concrete subclasses of this class.- Parameters:
ix
- The X position of this valueiy
- The Y position of this valueiz
- The Z position of this valueval
- The value to plot.
-
-