public class AxesGraph extends Graph
The AxesGraph class represents any type of graph that's plotted against an axis  bar graphs, line graphs and so on.
An AxesGraph is made up of several components.
Series
, representing the data plotted on the graph. A series may consist of bars,
lines etc. A series is plotted against exactly two Axes
 the typical arrangement
for a graph is against the bottom and left
axes. Each series is plotted in the order
they are added to the graph, one behind the other.
Axes
, positioned at the left, bottom, right or top of the graph. These
represent the scale against which anything on the graph is plotted. The Axis
class is the
superclass of all the different types of Axes which may be used, and the setAxis
and getAxis
methods used to set and get the specified axis on the graph.
Axis.setWallPaint
method. The AxesGraph as a whole may have a
"back wall", which is set using the setBackWallPaint(java.awt.Paint)
method.
AxesGraph graph = new AxesGraph(); BarSeries series = new BarSeries("Fruit"); series.set("Apples", 20); series.set("Oranges", 30); series.set("Bananas", 15); graph.addSeries(series);
BarSeries
,
LineSeries
,
NumericAxis
,
Graph
Modifier and Type  Field and Description 

static int 
BOTTOMLEFT
Constant used by the
addSeries method to plot the series
against the bottom and left axes. 
static int 
BOTTOMRIGHT
Constant used by the
addSeries method to plot the series
against the bottom and right axes. 
static int 
TOPLEFT
Constant used by the
addSeries method to plot the series
against the top and left axes. 
static int 
TOPRIGHT
Constant used by the
addSeries method to plot the series
against the top and right axes. 
Constructor and Description 

AxesGraph()
Create a new AxesGraph

Modifier and Type  Method and Description 

void 
addSeries(Series series)
Add a series to this Graph, plotted against the bottom and left axes.

void 
addSeries(Series series,
int pos)
Add a series to this Graph, plotted against the specified axes.

Axis 
getAxis(int pos)
Get the axis that's currently in the specified position on the graph.

Series 
getSeries(String name)
Return the series with the specified name from this AxesGraph, or
null if no such series has been added yet 
void 
setAxis(int pos,
Axis axis)
Set the specified axis.

void 
setBackWallPaint(Paint paint)
Set the paint to use on the back wall.

void 
setBackWallPaint(Paint[] paints,
Color stripe,
int axis,
int alt,
double[] dash)
Set the paint to use on the back wall to a series of stripes.

void 
setBackWallPaint(StripedPaint paint)
Set the paint to use on the back wall to a
StripedPaint . 
void 
setHorizontalScale(double b1,
double t1,
double b2,
double t2)
Change the scaling ratio for the horizontal axes.

void 
setVerticalScale(double l1,
double r1,
double l2,
double r2)
Change the scaling ratio for the vertical axes.

addKey, addKey, addText, draw, getActualOffset, getActualZoom, interrupt, isInterrupted, isOverlapping, setAutoColors, setColorOrdering, setDefaultColors, setFixedAspectRatio, setFixedSize, setLicenseKey, setLightLevel, setLightVector, setMetaData, setOption, setXRotation, setYRotation, setZRotation
public static final int BOTTOMLEFT
addSeries
method to plot the series
against the bottom and left axes.public static final int BOTTOMRIGHT
addSeries
method to plot the series
against the bottom and right axes.public static final int TOPLEFT
addSeries
method to plot the series
against the top and left axes.public static final int TOPRIGHT
addSeries
method to plot the series
against the top and right axes.public void addSeries(Series series)
series
 the Series
to add to the graphIllegalArgumentException
 if the series has already been addedpublic void addSeries(Series series, int pos)
series
 the Series to add to the graphpos
 the axes to plot the series against. One of BOTTOMLEFT
,
BOTTOMRIGHT
, TOPLEFT
or TOPRIGHT
.IllegalArgumentException
 if the series has already been addedpublic Series getSeries(String name)
null
if no such series has been added yetname
 the name of the series to returnnull
if it doesn't exist in this Graphpublic void setAxis(int pos, Axis axis)
NumericAxis
,
but this method can be used to override this to plot dates, currencies and so on.
The "Z" axis can be useful when graphs are displayed in 3D  it can be set to a
ZAxis
object to show the names of each Series plotted on the graphpos
 which axis to set  one of Axis.LEFT
, Axis.TOP
, Axis.RIGHT
Axis.BOTTOM
or Axis.ZAXIS
axis
 the axis to useIllegalArgumentException
 if the specified Axis has already been used elsewheregetAxis(int)
public Axis getAxis(int pos)
Get the axis that's currently in the specified position on the graph. If you've already
called setAxis
to set it, then that's the one that's returned.
If one hasn't been set, a default axis is used  this will be a NullAxis
if no series
have been plotted against this axis, a NumericAxis
if a series has been
plotted, or in the case of the Xaxis of a BarSeries, a BarAxis
is returned.
Because the returned axis may change depending on which Series have been added to the graph, it's recommended that this method is called after all the Series have been added.
pos
 which axis to get  one of Axis.LEFT
, Axis.TOP
, Axis.RIGHT
Axis.BOTTOM
or Axis.ZAXIS
setAxis(int, org.faceless.graph2.Axis)
public void setBackWallPaint(Paint paint)
setBackWallPaint(Paint[], Color, int, int, double[])
method.paint
 the paint to use on the back wall, or null
to not paint the back wallAxis.setWallPaint(java.awt.Paint)
public void setBackWallPaint(Paint[] paints, Color stripe, int axis, int alt, double[] dash)
Set the paint to use on the back wall to a series of stripes. Note this
now method calls setBackWallPaint(StripedPaint)
, which is a more
flexible way to achieve the same results. The stripes
will be painted in the colors specified by paints
, and if
stripe
is not null the stripes will be separated by lines of
that color. The stripes will be aligned with the Axis specified by axis
,
and if alt
is not 0, lines will also be drawn matching that
axis (which must be perpendicular to axis
).
Some examples to clarify: To draw horizontal stripes in blue and green:
setBackWallPaint(new Paint[] { Color.blue, Color.green }, null, Axis.LEFT, 0, null);
To draw a grid of gray lines with no fill color
setBackWallPaint(null, Color.gray, Axis.LEFT, Axis.BOTTOM, null);
paints
 the colors to use to paint the background  may be null for no paint,
or an array of one or more Paint
objects which will be used to stripe the wallstripe
 the color to use to draw lines between the stripes, or null
for no stripesaxis
 The axis to align the stripes to. One of Axis.LEFT
,
Axis.RIGHT
, Axis.TOP
or Axis.BOTTOM
alt
 The alternate axis to use when drawing a grid. If axis
is Axis.LEFT
or Axis.RIGHT
, must be Axis.TOP
or
Axis.BOTTOM
, and vice versa. If no grid is required this value may be 1.dash
 The dash pattern to use to draw the stripe  specified the same way as
Style.setLineDash(double[])
. If no stripe is to be drawn (or if it's not going to be
dashed) this may be null.public void setBackWallPaint(StripedPaint paint)
Set the paint to use on the back wall to a StripedPaint
. See
the other method with the same name for some examples of what sort of
functionality is available
public void setHorizontalScale(double b1, double t1, double b2, double t2)
b1
 first value on the bottom axis (aligned with t1)t1
 first value on the top axis (aligned with b1)b2
 second value on the bottom axis (aligned with t2)t2
 second value on the top axis (aligned with b2)IllegalArgumentException
 if b1<=b2 and t1>=t2setVerticalScale(double, double, double, double)
public void setVerticalScale(double l1, double r1, double l2, double r2)
l1
 first value on the left axis (aligned with r1)r1
 first value on the right axis (aligned with l1)l2
 second value on the left axis (aligned with r2)r2
 second value on the right axis (aligned with r2)IllegalArgumentException
 if l1<=l2 and r1>=r2setHorizontalScale(double, double, double, double)
Copyright © 20012016 Big Faceless Organization