Package com.day.cq.graphics
Class Graph
- java.lang.Object
-
- com.day.cq.graphics.Graph
-
public class Graph extends java.lang.Object
TheGraph
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.
-
-
Field Summary
Fields Modifier and Type Field Description 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
Constructors Constructor Description Graph(int width, int height, java.lang.String type)
Creates a graph chart of the given width, height and type.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Layer
createLayer(boolean doDraw, int width, int height)
Layer
draw(boolean doDraw)
java.awt.Color
getBgColor()
Chart
getChart()
Data
getData()
java.awt.Rectangle
getExtent()
int
getFlags()
Grid
getGrid()
int
getMaxcols()
int
getMaxrows()
Metrics
getMetrics()
Axis
getXAxis()
Axis
getYAxis()
void
initGraphSamples(java.lang.String[][] dataTable, boolean nocateg, boolean nolabels)
void
initGraphSamples(java.lang.String[] labels, java.lang.String[] legends, double[][] samples)
void
setBgColor(java.awt.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)
-
-
-
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, java.lang.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 theChart.getInstance(String)
method. See there for a definition of this parameter.- Parameters:
width
- The desired overall width of the graph chartheight
- The desired overall height of the graph charttype
- The type of chart to draw. The value of this parameter is defined byChart.getInstance(String)
.
-
-
Method Detail
-
initGraphSamples
public void initGraphSamples(java.lang.String[] labels, java.lang.String[] legends, double[][] samples)
-
initGraphSamples
public void initGraphSamples(java.lang.String[][] dataTable, boolean nocateg, boolean nolabels)
-
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(java.awt.Color bgcolor)
- See Also:
setBgColor(java.awt.Color)
-
getBgColor
public java.awt.Color getBgColor()
- See Also:
getBgColor()
-
getChart
public Chart getChart()
- See Also:
getChart()
-
getExtent
public java.awt.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)
-
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()
-
-