Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.faceless.graph
Class Graph

    java.lang.Object
      org.faceless.graph.Graph

Direct Known Subclasses:
  AxesGraph, PieGraph

    public abstract class Graph

extends Object

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

### KEY_NONE

    public static final int KEY_NONE

  The Graph should have no key at all

  See Also:
    Constant Field Values

### KEY_BOXED_BOTTOM

    public static final int KEY_BOXED_BOTTOM

  The Graph should have a key in a box at the bottom of the output

  See Also:
    Constant Field Values

### KEY_BOXED_RIGHT

    public static final int KEY_BOXED_RIGHT

  The Graph should have a key in a box to the right of the output

  See Also:
    Constant Field Values

### KEY_BOXED_LEFT

    public static final int KEY_BOXED_LEFT

  The Graph should have a key in a box to the left of the output

  See Also:
    Constant Field Values

### KEY_BOXED_TOP

    public static final int KEY_BOXED_TOP

  The Graph should have a key in a box above the output

  See Also:
    Constant Field Values

Method Detail

### setDefaultColors

    public void setDefaultColors(Paint[] colors)

  Set the default colors for the graph. Each new element that is added will use the next color in this list - if there are no unused colors left, the list is reset to the beginning.

### optionTitle

    public void optionTitle(String val)

  The title to give the graph

  Default: empty string

### optionSubTitle

    public void optionSubTitle(String val)

  The sub-title to give the graph

  Default: empty string

### optionTitleStyle

    public void optionTitleStyle(Style val)

  The Style to give to the title of the graph

  Default: Black 16pt Helvetica

### optionSubTitleStyle

    public void optionSubTitleStyle(Style val)

  The Style to give to the sub-title of the graph

  Default: Black 12pt Helvetica

### optionXRotation

    public 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.

  Default: 0

### optionYRotation

    public 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.

  Default: 0

### optionZRotation

    public 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.

  Default: 0

### optionDisplayKey

    public void optionDisplayKey(int val)

  What type of external key to display on the graph. Valid options for all graphs include `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

### optionKeyStyle

    public void optionKeyStyle(Style val)

  The Style to give to the text used in the external key

  Default: Black 10pt Helvetica

### optionKeyBoxStyle

    public void optionKeyBoxStyle(Style val)

  The Style to give to the box holding the external key. Only used if the `optionDisplayKey` is set to a variety of `BOXED`

  Default: Color #FFFFE0, with a black border

### optionFixedAspectRatio

    public void optionFixedAspectRatio(boolean val)

  Whether this graph should have a fixed aspect ratio. For every graph except `PieGraph`, this should be left at the default.

  Default: true for subclass `PieGraph`, false otherwise

### toCanvas

    public final void toCanvas(Output o)

  starts the conversion of the graph from values added through the `set()` or `setCurve()` methods to an `Output`.

  Parameters:
    `o` - the `Output` to pain the graph onto.

### setLicenseKey

    public static void setLicenseKey(String skey)

  Set the license key for the library. When the library is purchased, the Big Faceless Organization supplies a key which disables the 30-day use restriction.

  Parameters:
    `skey` - the license key

### setFontScale

    public 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. This was intended for subclasses of `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

  Since:
    1.0.3

### getFontScale

    public double getFontScale()

  Return the current font scale. See `setFontScale(double)`

  Replaces the equivalent static method in the `Style` class

  Since:
    1.0.3

### setLightLevel

    public void setLightLevel(int level)

  Set the level of light (technically, the level of shade) that should be applied to a graph. A value of 0 is no shading at all, a value of 100 gives deep shadows. The default is 70.

  Replaces the equivalent static method in the `Style` class

  Since:
    1.0.3

### setLightVector

    public void setLightVector(int x,
                               int y,
                               int z)

  Set the vector of where the light is coming from. The light is assumed to be coming from an infinite distance away in the specified direction, so don't worry about the length of the vector. The default is (1,0,0), which makes the light appear to come from the right side of the graph. Calling `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

  Since:
    1.0.3

### setDefaultBorderColor

    public void setDefaultBorderColor(Color c)

  This method changes the default border color of new styles. By default, this is set to black, but it can be set to null for a different look, or a different color altogether. This is useful if the graph is to be rendered over a black background, for example.

  Replaces the equivalent static method in the `Style` class

  Since:
    1.0.3

### getDefaultBorderColor

    public Color getDefaultBorderColor()

  Returns the value set by `setDefaultBorderColor(java.awt.Color)`

  Replaces the equivalent static method in the `Style` class

  Since:
    1.0.3

### setDefaultLineThickness

    public 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. Not all Output classes can use this option. A value of zero means "make the lines as thin as possible".

  Replaces the equivalent static method in the `Style` class

  Since:
    1.0.3

### setPieEdgeDegrees

    public void setPieEdgeDegrees(double val)

  Adjust the number of degrees taken by each of the small faces used to draw the edge of a PieGraph. The higher the number of faces, the less noticeable the "banding" effect will be on the edge of a 3D shaded PieGraph, but at the expense of slower rendering. The default value is 5 degrees.

  Replaces the equivalent static method in the `Style` class

  Parameters:
    `val` - the number of degrees per face at the edge of a PieGraph
  Since:
    1.0.3

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2001-2012 Big Faceless Organization