SSJ  3.3.1
Stochastic Simulation in Java
Public Member Functions | Protected Attributes | List of all members
CategoryChart Class Referenceabstract

This class provides tools to create charts from data in a simple way. More...

Inheritance diagram for CategoryChart:
[legend]
Collaboration diagram for CategoryChart:
[legend]

Public Member Functions

JFreeChart getJFreeChart ()
 Returns the JFreeChart object associated with this chart. More...
 
Axis getYAxis ()
 Returns the chart’s range axis ( \(y\)-axis) object. More...
 
abstract JFrame view (int width, int height)
 Displays the chart on the screen using Swing. More...
 
String getTitle ()
 Gets the current chart title. More...
 
void setTitle (String title)
 Sets a title to this chart. More...
 
void setAutoRange ()
 Sets chart \(y\) range to automatic values.
 
void enableGrid (double xstep, double ystep)
 Puts a grid on the background. More...
 
void disableGrid ()
 Disables the background grid.
 

Protected Attributes

Axis YAxis
 
SSJCategorySeriesCollection dataset
 
JFreeChart chart
 
boolean latexDocFlag = true
 
boolean autoRange
 
double [] manualRange
 
boolean grid = false
 
double ystepGrid
 
final double BOR = 0.1
 

Latex-specific methods

abstract String toLatex (double width, double height)
 Transforms the chart into LaTeX form and returns it as a String.
 
void setLatexDocFlag (boolean flag)
 Same as in XYChart.
 
double computeYScale (double position)
 
double computeScale (double[] bounds)
 

Detailed Description

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 umontreal.ssj.charts.SSJCategorySeriesCollection object representing the data, and an umontreal.ssj.charts.Axis object representing the axis. 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, 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.

Member Function Documentation

◆ enableGrid()

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.

Parameters
xstepsets the step in the x-direction.
ystepsets the step in the y-direction.

◆ getJFreeChart()

JFreeChart getJFreeChart ( )

Returns the JFreeChart object associated with this chart.

Returns
the associated JFreeChart object.

◆ getTitle()

String getTitle ( )

Gets the current chart title.

Returns
Chart title.

◆ getYAxis()

Axis getYAxis ( )

Returns the chart’s range axis ( \(y\)-axis) object.

Returns
chart’s range axis ( \(y\)-axis) object.

◆ setTitle()

void setTitle ( String  title)

Sets a title to this chart.

This title will appear on the chart displayed by method view.

Parameters
titlechart title

◆ view()

abstract JFrame view ( int  width,
int  height 
)
abstract

Displays the chart on the screen using Swing.

Parameters
widthframe width
heightframe height
Returns
frame containing the chart

The documentation for this class was generated from the following file: