com.day.cq.graphics
Class Graph

java.lang.Object
  extended by com.day.cq.graphics.Graph

public class Graph
extends Object

The Graph class implements the basic functionality for the chart host object. This class is based on the former rgba/rgba_graph.c code.

The Graph object is the top level container of a chart graphic. It contains all the elements such as the axis, the data and the chart itself.

This object is not truly unmutable, but it is mostly write-once. That is, as soon as a property has been defined through its setter method, it cannot be changed again. It is completely in the responsability of the client not to tamper with any values after having calculated the graph. Moreover it is the clients duty to ensure complete setting of the graph and its component prior to drawing the chart. The results may not be as desired if failing to do so.

Author:
fmeschbe

Field Summary
static int FLAGS_FIT
          Flag to indicate the chart to fit the extent.
static int FLAGS_NON_ANTI_ALIASED
          Flag to indicate non-anti-aliased drawing
 
Constructor Summary
Graph(int width, int height, String type)
          Creates a graph chart of the given width, height and type.
 
Method Summary
 Layer createLayer(boolean doDraw, int width, int height)
           
 Layer draw(boolean doDraw)
           
 Color getBgColor()
           
 Chart getChart()
           
 Data getData()
           
 Rectangle getExtent()
           
 int getFlags()
           
 Grid getGrid()
           
 int getMaxcols()
           
 int getMaxrows()
           
 Metrics getMetrics()
           
 Axis getXAxis()
           
 Axis getYAxis()
           
 void initGraphSamples(String[][] dataTable, boolean nocateg, boolean nolabels)
           
 void initGraphSamples(String[] labels, String[] legends, double[][] samples)
           
 void setBgColor(Color bgcolor)
           
 void setFlags(int flags)
           
 void setGrid(Grid grid)
           
 void setMaxcols(int maxcols)
           
 void setMaxrows(int maxrows)
           
 void setXAxis(Axis x)
           
 void setYAxis(Axis y)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

FLAGS_FIT

public static final int FLAGS_FIT
Flag to indicate the chart to fit the extent.

See Also:
Constant Field Values

FLAGS_NON_ANTI_ALIASED

public static final int FLAGS_NON_ANTI_ALIASED
Flag to indicate non-anti-aliased drawing

See Also:
Constant Field Values
Constructor Detail

Graph

public Graph(int width,
             int height,
             String type)
Creates a graph chart of the given width, height and type. The type parameter is used to create the chart object and depends on the Chart.getInstance(String) method. See there for a definition of this parameter.

Parameters:
width - The desired overall width of the graph chart
height - The desired overall height of the graph chart
type - The type of chart to draw. The value of this parameter is defined by Chart.getInstance(String).
Method Detail

initGraphSamples

public void initGraphSamples(String[] labels,
                             String[] legends,
                             double[][] samples)
See Also:
initGraphSamples(java.lang.String[], java.lang.String[], double[][])

initGraphSamples

public void initGraphSamples(String[][] dataTable,
                             boolean nocateg,
                             boolean nolabels)
See Also:
initGraphSamples(java.lang.String[][], boolean, boolean)

draw

public Layer draw(boolean doDraw)
See Also:
draw(boolean)

createLayer

public Layer createLayer(boolean doDraw,
                         int width,
                         int height)
See Also:
createLayer(boolean, int, int)

setBgColor

public void setBgColor(Color bgcolor)
See Also:
setBgColor(java.awt.Color)

getBgColor

public Color getBgColor()
See Also:
getBgColor()

getChart

public Chart getChart()
See Also:
getChart()

getData

public Data getData()
See Also:
getData()

getExtent

public Rectangle getExtent()
See Also:
getExtent()

setFlags

public void setFlags(int flags)
See Also:
setFlags(int)

getFlags

public int getFlags()
See Also:
getFlags()

setGrid

public void setGrid(Grid grid)
See Also:
setGrid(com.day.cq.graphics.chart.Grid)

getGrid

public Grid getGrid()
See Also:
getGrid()

setMaxcols

public void setMaxcols(int maxcols)
See Also:
setMaxcols(int)

getMaxcols

public int getMaxcols()
See Also:
getMaxcols()

setMaxrows

public void setMaxrows(int maxrows)
See Also:
setMaxrows(int)

getMaxrows

public int getMaxrows()
See Also:
getMaxrows()

getMetrics

public Metrics getMetrics()
See Also:
getMetrics()

setXAxis

public void setXAxis(Axis x)
See Also:
setXAxis(com.day.cq.graphics.chart.Axis)

getXAxis

public Axis getXAxis()
See Also:
getXAxis()

setYAxis

public void setYAxis(Axis y)
See Also:
setYAxis(com.day.cq.graphics.chart.Axis)

getYAxis

public Axis getYAxis()
See Also:
getYAxis()


Copyright © 2011-2013 Adobe Systems Incorporated. All Rights Reserved.