|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.faceless.graph.Graph
public abstract class Graph
The abstract base class for all Graphs in the
org.faceless.graph
package.
This class controls the building and rendering of the graph, adding the key and any annotations if necessary and rotating or scaling it as required. It doesn't contain any information about how to lay out the data - this is all taken care of by it's subclasses.
All the types of Graph in the package have certain things in common.
All the graphs are fully 3D. By default they are seen head-on and so look
two-dimensional, but can be rotated to any angle to give a 3D effect by
calling optionXRotation
and it's friends.
They all have data added two them in one of two ways - for
discrete data, via the set()
method, and for continuous
data via the setCurve()
method. The exact forms of these
methods vary from subclass to subclass. The order in which the subsets
appear on the Graph is the same as the order in which they were first
specified.
The look of the Graphs is controlled by calling the option
methods,
which an be used to set titles, axes labels and so on. As the name implies
all of these methods are optional, and don't have to be called to
create a Graph.
Finally, all the graphs when complete are sent to an output
device - be it a PDF document, a java.awt.Image
or a
specific image format. This is done with the render()
method
Concrete subclasses in this release are the PieGraph
,
BarGraph
, TowerBarGraph
, DepthBarGraph
,
LineGraph
, AreaGraph
and FloatingBarGraph
, and
more will be added in future releases.
Field Summary | |
---|---|
static int |
KEY_BOXED_BOTTOM
The Graph should have a key in a box at the bottom of the output |
static int |
KEY_BOXED_LEFT
The Graph should have a key in a box to the left of the output |
static int |
KEY_BOXED_RIGHT
The Graph should have a key in a box to the right of the output |
static int |
KEY_BOXED_TOP
The Graph should have a key in a box above the output |
static int |
KEY_NONE
The Graph should have no key at all |
Method Summary | |
---|---|
Color |
getDefaultBorderColor()
Returns the value set by setDefaultBorderColor(java.awt.Color)
Replaces the equivalent static method in the Style class |
double |
getFontScale()
Return the current font scale. |
void |
optionDisplayKey(int val)
What type of external key to display on the graph. |
void |
optionFixedAspectRatio(boolean val)
Whether this graph should have a fixed aspect ratio. |
void |
optionKeyBoxStyle(Style val)
The Style to give to the box holding the external key. |
void |
optionKeyStyle(Style val)
The Style to give to the text used in the external key Default: Black 10pt Helvetica |
void |
optionSubTitle(String val)
The sub-title to give the graph Default: empty string |
void |
optionSubTitleStyle(Style val)
The Style to give to the sub-title of the graph Default: Black 12pt Helvetica |
void |
optionTitle(String val)
The title to give the graph Default: empty string |
void |
optionTitleStyle(Style val)
The Style to give to the title of the graph Default: Black 16pt Helvetica |
void |
optionXRotation(double val)
How far to rotate the graph around the X-axis (the line running from the left of the graph to the right), in degrees. |
void |
optionYRotation(double val)
How far to rotate the graph around the Y-axis (the line running from the top of the graph to the bottom), in degrees. |
void |
optionZRotation(double val)
How far to rotate the graph around the Z-axis (the line running from the front of the graph to the back), in degrees. |
void |
setDefaultBorderColor(Color c)
This method changes the default border color of new styles. |
void |
setDefaultColors(Paint[] colors)
Set the default colors for the graph. |
void |
setDefaultLineThickness(double thickness)
Set the default line thickness for all styles. 1 is the default, 0.5 is half as thick, and so on. |
void |
setFontScale(double val)
Every text element that's created may have it's font automatically scaled up or down by a percentage by setting a different fontscale. |
static void |
setLicenseKey(String skey)
Set the license key for the library. |
void |
setLightLevel(int level)
Set the level of light (technically, the level of shade) that should be applied to a graph. |
void |
setLightVector(int x,
int y,
int z)
Set the vector of where the light is coming from. |
void |
setPieEdgeDegrees(double val)
Adjust the number of degrees taken by each of the small faces used to draw the edge of a PieGraph. |
void |
toCanvas(Output o)
starts the conversion of the graph from values added through the set() or setCurve() methods to an
Output . |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int KEY_NONE
public static final int KEY_BOXED_BOTTOM
public static final int KEY_BOXED_RIGHT
public static final int KEY_BOXED_LEFT
public static final int KEY_BOXED_TOP
Method Detail |
---|
public void setDefaultColors(Paint[] colors)
public void optionTitle(String val)
Default: empty string
public void optionSubTitle(String val)
Default: empty string
public void optionTitleStyle(Style val)
Default: Black 16pt Helvetica
public void optionSubTitleStyle(Style val)
Default: Black 12pt Helvetica
public void optionXRotation(double val)
Default: 0
public void optionYRotation(double val)
Default: 0
public void optionZRotation(double val)
Default: 0
public void optionDisplayKey(int val)
KEY_NONE
, KEY_BOXED_BOTTOM
,
KEY_BOXED_RIGHT
, KEY_BOXED_LEFT
and KEY_BOXED_TOP
,
and subclasses (in particular the PieGraph
may have additional
values available.
Default: Usually KEY_BOXED_BOTTOM
, but may vary for subclasses
public void optionKeyStyle(Style val)
Default: Black 10pt Helvetica
public void optionKeyBoxStyle(Style val)
optionDisplayKey
is set to a variety of
BOXED
Default: Color #FFFFE0, with a black border
public void optionFixedAspectRatio(boolean val)
PieGraph
, this should be left at the default.
Default: true for subclass PieGraph
, false otherwise
public final void toCanvas(Output o)
starts the conversion of the graph from values added through the
set()
or setCurve()
methods to an
Output
.
o
- the Output
to pain the graph onto.public static void setLicenseKey(String skey)
skey
- the license keypublic void setFontScale(double val)
Output
, so those that use a totally
different scaling can set it in one go. But it's useful for
the end user too. The default is 1, and a value of 0.5 would make
all the text half the original size.
Replaces the equivalent static method in the Style class
public double getFontScale()
setFontScale(double)
Replaces the equivalent static method in the Style class
public void setLightLevel(int level)
Replaces the equivalent static method in the Style class
public void setLightVector(int x, int y, int z)
graph.setLightVector(-1,0,1)
would put the light to the left
and in front of the graph, while a vector (0,-1,0) would put the light
directly underneath the graph, for a strange result indeed.
Replaces the equivalent static method in the Style class
public void setDefaultBorderColor(Color c)
Replaces the equivalent static method in the Style class
public Color getDefaultBorderColor()
setDefaultBorderColor(java.awt.Color)
Replaces the equivalent static method in the Style class
public void setDefaultLineThickness(double thickness)
Replaces the equivalent static method in the Style class
public void setPieEdgeDegrees(double val)
Replaces the equivalent static method in the Style class
val
- the number of degrees per face at the edge of a PieGraph
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |