|
SSJ V. 2.6.2. |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object umontreal.iro.lecuyer.charts.XYChart
public abstract class XYChart
This class provides tools to create charts from data in a simple way. Its main
feature is to produce
TikZ/PGF (see WWW link http://sourceforge.net/projects/pgf/)
compatible source code which can be included
in LATEX documents, but it can also produce charts in other formats.
One can easily create a new chart, and customize its appearance using methods
of this class, with the encapsulated
SSJXYSeriesCollection
object
representing the data, and the two
Axis
objects representing the axes.
All these classes depend on the JFreeChart API (see WWW link
http://www.jfree.org/jfreechart/) which provides tools to build charts with
Java, to draw them, and export them to files. However, only basic features are
used here.
Moreover, XYChart provides methods to plot data using a MATLAB friendly syntax. None of these methods provides new features; they just propose a different syntax to create charts. Therefore some features are unavailable when using these methods only.
Constructor Summary | |
---|---|
XYChart()
|
Method Summary | |
---|---|
void |
disableGrid()
Disables the background grid. |
void |
drawVerticalLine(double x,
String name,
double yfrac,
boolean right)
Draws a vertical line on the chart at x-coordinate x. |
void |
enableGrid(double xstep,
double ystep)
Puts a grid on the background. |
double |
getChartMargin()
Returns the chart margin, which is the fraction by which the chart is enlarged on its borders. |
JFreeChart |
getJFreeChart()
Returns the JFreeChart object associated with this chart. |
String |
getTitle()
Gets the current chart title. |
Axis |
getXAxis()
Returns the chart's domain axis (x-axis) object. |
Axis |
getYAxis()
Returns the chart's range axis (y-axis) object. |
void |
setAutoRange()
The x and the y ranges of the chart are set automatically. |
void |
setAutoRange(boolean right,
boolean top)
The x and the y ranges of the chart are set automatically. |
void |
setAutoRange00(boolean xZero,
boolean yZero)
The x and the y ranges of the chart are set automatically. |
void |
setChartMargin(double margin)
Sets the chart margin to margin. |
void |
setLatexDocFlag(boolean flag)
Flag to remove the \documentclass (and other) commands in the
created LATEX files. |
void |
setManualRange(double[] range)
Sets the x and y ranges of the chart using the format: range = [xmin, xmax, ymin, ymax]. |
void |
setManualRange(double[] range,
boolean right,
boolean top)
Sets the x and y ranges of the chart using the format: range = [xmin, xmax, ymin, ymax]. |
void |
setManualRange00(double[] range,
boolean xZero,
boolean yZero)
Sets the x and y ranges of the chart using the format: range = [xmin, xmax, ymin, ymax]. |
void |
setprobFlag(boolean flag)
Must be set true when plotting probabilities, false otherwise. |
abstract void |
setTicksSynchro(int s)
Synchronizes x-axis ticks to the s-th series x-values. |
void |
setTitle(String title)
Sets a title to this chart. |
abstract String |
toLatex(double width,
double height)
Exports the chart to a LATEX source code using PGF/TikZ. |
void |
toLatexFile(String fileName,
double width,
double height)
Transforms the chart to LATEX form and writes it in file fileName. |
abstract JFrame |
view(int width,
int height)
Displays chart on the screen using Swing. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public XYChart()
Method Detail |
---|
public JFreeChart getJFreeChart()
public Axis getXAxis()
public Axis getYAxis()
public abstract JFrame view(int width, int height)
public String getTitle()
public void setTitle(String title)
view
.
title
- chart title.public void setprobFlag(boolean flag)
flag
- true for plotting probabilitiespublic void setAutoRange()
public void setAutoRange(boolean right, boolean top)
right
- true if the x-values on the right of axis.top
- true if the y-values on the top of axis.public void setAutoRange00(boolean xZero, boolean yZero)
xZero
- true if vertical axis passes through point 0yZero
- true if horizontal axis passes through point 0public void setManualRange(double[] range)
range
- new axis ranges.public void setManualRange(double[] range, boolean right, boolean top)
range
- new axis ranges.right
- true if the x-values on the right.top
- true if the y-values on the top.public void setManualRange00(double[] range, boolean xZero, boolean yZero)
xZero
- true if vertical axis passes through point 0yZero
- true if horizontal axis passes through point 0public double getChartMargin()
public void setChartMargin(double margin)
margin
- margin percentage amount.public abstract void setTicksSynchro(int s)
s
- series.public void drawVerticalLine(double x, String name, double yfrac, boolean right)
x
- x-coordinate of the linename
- description of the lineyfrac
- y-position of nameright
- x-position of namepublic void enableGrid(double xstep, double ystep)
xstep
- sets the step in the x-direction.ystep
- sets the step in the y-direction.public void disableGrid()
public abstract String toLatex(double width, double height)
width
- Chart's width in centimeters.height
- Chart's height in centimeters.
public void toLatexFile(String fileName, double width, double height)
public void setLatexDocFlag(boolean flag)
\documentclass
(and other) commands in the
created LATEX files.
If flag is true, then when charts are translated into
LATEX form, it will be as a self-contained file that can be directly
compiled with LATEX. However, in this form, the file cannot be included in
another LATEX file without causing compilation errors because of the multiple
instructions \documentclass
and \begin{document}
.
By setting flag to false, these instructions will be
removed from the LATEX chart files, which can then be included in a master
LATEX file. By default, the flag is true.
|
SSJ V. 2.6.2. |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |