|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.faceless.graph.Graph
org.faceless.graph.AxesGraph
org.faceless.graph.AbstractLineGraph
org.faceless.graph.LineGraph
public class LineGraph
A subclass of AbstractLineGraph that plots one or more separate curves - a typical Line Graph.
This class changes the default for optionXAxisAtZero and
optionYAxisAtZero to true.
Here is a simple example that graphs two curves - the first,
a set of datapoints defined by a
DataCurve, the second a
Spline curve that's fitted
to the DataCurve.
import org.faceless.graph.output.ImageOutput;
import org.faceless.graph.math.*;
import java.awt.Color;
// Create a simple datacurve with 4 points.
//
DataCurve data = new DataCurve();
data.set(1,10);
data.set(2,15);
data.set(3,8);
data.set(5,11);
// Plot the data in red on a linegraph, with a diamond
// at each point.
//
LineGraph g = new LineGraph();
g.setCurve("My Data", data, Color.red);
g.setCurveMarker("My Data", LineGraph.MARKER_DIAMOND);
// Add a "smoothed" version of this DataCurve in green.
//
Curve smooth = new Spline(Spline.CATMULLROM, data);
g.setCurve("Smoothed Data", smooth, Color.green);
// Add a title to the graph
//
g.optionTitle("My First Line Graph");
// Render to an image that's 400x400
//
ImageOutput out = new ImageOutput(400,400);
out.render(g);
| Field Summary | |
|---|---|
static int |
KEY_SHOW_MARKERS
If markers are to be displayed on the key, add this value to the parameter passed to Graph.optionDisplayKey(int). |
static int |
MARKER_BIG
Add this value to the marker type to double the size of the marker. |
static int |
MARKER_CIRCLE
A marker in the shape of a circle |
static int |
MARKER_DIAMOND
A marker in the shape of a diamond |
static int |
MARKER_DOWNTRIANGLE
A marker in the shape of a triangle pointing down |
static int |
MARKER_LINE
A marker that looks like a join in the line. |
static int |
MARKER_NOBORDER
Add this value to the marker type to remove the border from around the marker. |
static int |
MARKER_NONE
No marker at all. |
static int |
MARKER_OCTAGON
A marker in the shape of an octagon |
static int |
MARKER_SMALL
Add this value to the marker type to reduce the size of the marker. |
static int |
MARKER_SQUARE
A marker in the shape of a square |
static int |
MARKER_UPTRIANGLE
A marker in the shape of a triangle pointing up |
static int |
MARKERS_ONLY
A special type of marker indicator that should be OR'ed with the marker type to indicate that only markers should be drawn - i.e. no lines, just markers. |
| Fields inherited from class org.faceless.graph.Graph |
|---|
KEY_BOXED_BOTTOM, KEY_BOXED_LEFT, KEY_BOXED_RIGHT, KEY_BOXED_TOP, KEY_NONE |
| Constructor Summary | |
|---|---|
LineGraph()
|
|
| Method Summary | |
|---|---|
void |
optionLineThickness(double val)
Set the "thickness" of the lines when drawing two-dimensional graphs. |
void |
setCurveMarker(String name,
int marker)
Set a marker to show significant points on the curve Not all points have significant points, but for DataCurve curves there
is a significant point at each data item. |
| Methods inherited from class org.faceless.graph.AbstractLineGraph |
|---|
optionCurveDepth, optionFunctionSmoothness, optionMaxDataPoints, optionMaxX, optionMinX, setCurve, setCurve |
| Methods inherited from class org.faceless.graph.Graph |
|---|
getDefaultBorderColor, getFontScale, optionDisplayKey, optionFixedAspectRatio, optionKeyBoxStyle, optionKeyStyle, optionSubTitle, optionSubTitleStyle, optionTitle, optionTitleStyle, optionXRotation, optionYRotation, optionZRotation, setDefaultBorderColor, setDefaultColors, setDefaultLineThickness, setFontScale, setLicenseKey, setLightLevel, setLightVector, setPieEdgeDegrees, toCanvas |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final int KEY_SHOW_MARKERS
Graph.optionDisplayKey(int). For
example, linegraph.optionDisplayKey(Graph.KEY_BOXED_BOTTOM + LineGraph.KEY_SHOW_MARKERS)
public static final int MARKER_NONE
public static final int MARKER_CIRCLE
public static final int MARKER_SQUARE
public static final int MARKER_OCTAGON
public static final int MARKER_DIAMOND
public static final int MARKER_LINE
public static final int MARKER_UPTRIANGLE
public static final int MARKER_DOWNTRIANGLE
public static final int MARKER_BIG
setCurveMarker("mycurve", MARKER_SQUARE+MARKER_BIG)
public static final int MARKER_SMALL
setCurveMarker("mycurve", MARKER_SQUARE+MARKER_SMALL)
public static final int MARKER_NOBORDER
setCurveMarker("mycurve", MARKER_CIRCLE+MARKER_NOBORDER)
public static final int MARKERS_ONLY
setCurveMarker("mycurve", MARKER_CIRCLE+MARKER_SMALL+MARKERS_ONLY)
| Constructor Detail |
|---|
public LineGraph()
| Method Detail |
|---|
public void setCurveMarker(String name,
int marker)
DataCurve curves there
is a significant point at each data item. Whether
a marker is plotted depends on the value passed to this
function.
name - The name of the curvemarker - The type if marker. Can be MARKER_NONE,
MARKER_LINE (the default), MARKER_SQUARE, MARKER_CIRCLE
MARKER_DIAMOND, MARKER_OCTAGON, MARKER_UPTRIANGLE
or MARKER_DOWNTRIANGLEpublic void optionLineThickness(double val)
Output.
It's mainly intended for plotting graphs to high-resolution output devices
like PDF or PostScript.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||