V. 2.6.

Class CategoryChart

  extended by umontreal.iro.lecuyer.charts.CategoryChart
Direct Known Subclasses:

public abstract class CategoryChart
extends Object

This class provides tools to create charts from data in a simple way. Its main feature is to produce TikZ/PGF (see WWW link 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 SSJCategorySeriesCollection object representing the data, and an Axis object representing the axis. All these classes depend on the JFreeChart API (see WWW link which provides tools to build charts with Java, to draw them, and export them to files. However, only basic features are used here.

Moreover, CategoryChart 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
Method Summary
 void disableGrid()
          Disables the background grid.
 void enableGrid(double xstep, double ystep)
          Puts a grid on the background.
 JFreeChart getJFreeChart()
          Returns the JFreeChart object associated with this chart.
 String getTitle()
          Gets the current chart title.
 Axis getYAxis()
          Returns the chart's range axis (y-axis) object.
 void setAutoRange()
          Sets chart y range to automatic values.
 void setLatexDocFlag(boolean flag)
          Same as in XYChart.
 void setTitle(String title)
          Sets a title to this chart.
abstract  String toLatex(double width, double height)
          Transforms the chart into LATEX form and returns it as a String.
abstract  JFrame view(int width, int height)
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Constructor Detail


public CategoryChart()
Method Detail


public JFreeChart getJFreeChart()
Returns the JFreeChart object associated with this chart.

the associated JFreeChart object.


public Axis getYAxis()
Returns the chart's range axis (y-axis) object.

chart's range axis (y-axis) object.


public abstract JFrame view(int width,
                            int height)


public String getTitle()
Gets the current chart title.

Chart title.


public void setTitle(String title)
Sets a title to this chart. This title will appear on the chart displayed by method view.

title - chart title.


public void setAutoRange()
Sets chart y range to automatic values.


public void enableGrid(double xstep,
                       double ystep)
Puts a grid on the background. It is important to note that the grid is always shifted in such a way that it contains the axes. Thus, the grid does not always have an intersection at the corner points; this occurs only if the corner points are multiples of the steps: xstep and ystep sets the step in each direction.

xstep - sets the step in the x-direction.
ystep - sets the step in the y-direction.


public void disableGrid()
Disables the background grid.


public abstract String toLatex(double width,
                               double height)
Transforms the chart into LATEX form and returns it as a String.


public void setLatexDocFlag(boolean flag)
Same as in XYChart.

V. 2.6.

To submit a bug or ask questions, send an e-mail to Pierre L'Ecuyer.