Overview | Package | Class | Tree | Deprecated | Index | Help
| SSJ V. 2.1.1.
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## umontreal.iro.lecuyer.charts
Class MultipleDatasetChart

    java.lang.Object
      umontreal.iro.lecuyer.charts.MultipleDatasetChart

    public class MultipleDatasetChart

extends Object

Provides tools to plot many datasets on the same chart. This class is mainly used to draw plots with different styles. Class `XYChart` and its subclasses are to be preferred to draw simple charts with one style. Datasets are stored in an `ArrayList`. The first dataset is called as the primary dataset.

Constructor Summary
`MultipleDatasetChart()` Initializes a new `MultipleDatasetChart`.
`MultipleDatasetChart(String title, String XLabel, String YLabel)` Initializes a new `MultipleDatasetChart` instance.

Method Summary
`int` | `add(SSJXYSeriesCollection dataset)` Adds a new dataset to the chart at the end of the list and returns its position.
`void` | `disableGrid()` Disables the background grid.
`void` | `enableGrid(double xstep, double ystep)` Puts grid on the background.
`SSJXYSeriesCollection` | `get()` Gets the primary dataset.
`SSJXYSeriesCollection` | `get(int datasetNum)` Gets the element at the specified position in the dataset list.
`org.jfree.chart.JFreeChart` | `getJFreeChart()` Returns the `JFreeChart` variable associated with this chart.
`ArrayList<SSJXYSeriesCollection>` | `getList()` Returns the dataset list.
`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` | `set(int datasetNum, SSJXYSeriesCollection dataset)` Replaces the element at the specified position in the dataset list with the specified element.
`void` | `set(SSJXYSeriesCollection dataset)` Sets the primary dataset for the plot, replacing the existing dataset if there is one.
`void` | `setAutoRange()` Sets chart range to automatic values.
`void` | `setLatexDocFlag(boolean flag)` Flag to remove the `\documentclass` (and other) commands in the created LATEX files.
`void` | `setManualRange(double[] axisRange)` Sets new x-axis and y-axis bounds, with format: `axisRange` = [xmin, xmax, ymin, ymax].
`void` | `setTitle(String title)` Sets a title to the chart.
`String` | `toLatex(double width, double height)` Exports the chart to a LATEX source code using PGF/TikZ.
`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

### MultipleDatasetChart

    public MultipleDatasetChart()

  Initializes a new `MultipleDatasetChart`.

### MultipleDatasetChart

    public MultipleDatasetChart(String title,
                                String XLabel,
                                String YLabel)

  Initializes a new `MultipleDatasetChart` instance. `title` sets a title, `XLabel` is a short description of the x-axis, and `YLabel` is a short description of the y-axis.

  Parameters:
    `title` - chart title.
    `XLabel` - Label on x-axis.
    `YLabel` - Label on y-axis.

Method Detail

### getJFreeChart

    public org.jfree.chart.JFreeChart getJFreeChart()

  Returns the `JFreeChart` variable associated with this chart.

  Returns:
    the associated JFreeChart variable.

### getXAxis

    public Axis getXAxis()

  Returns the chart's domain axis (x-axis) object.

  Returns:
    chart's domain axis (x-axis) object.

### getYAxis

    public Axis getYAxis()

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

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

### getTitle

    public String getTitle()

  Gets the current chart title.

  Returns:
    Chart title.

### setTitle

    public void setTitle(String title)

  Sets a title to the chart. This title will appear on the chart displayed by method `view`.

  Parameters:
    `title` - chart title.

### setAutoRange

    public void setAutoRange()

  Sets chart range to automatic values.

### setManualRange

    public void setManualRange(double[] axisRange)

  Sets new x-axis and y-axis bounds, with format: `axisRange` = [xmin, xmax, ymin, ymax].

  Parameters:
    `axisRange` - new axis ranges.

### add

    public int add(SSJXYSeriesCollection dataset)

  Adds a new dataset to the chart at the end of the list and returns its position.

  Parameters:
    `dataset` - dataset to add.
  Returns:
    the dataset position in the list.

### get

    public SSJXYSeriesCollection get()

  Gets the primary dataset.

  Returns:
    dataset.

### set

    public void set(SSJXYSeriesCollection dataset)

  Sets the primary dataset for the plot, replacing the existing dataset if there is one.

  Parameters:
    `dataset` - the new primary dataset.

### get

    public SSJXYSeriesCollection get(int datasetNum)

  Gets the element at the specified position in the dataset list.

  Parameters:
    `datasetNum` - position in the dataset list.
  Returns:
    dataset.

### set

    public void set(int datasetNum,
                    SSJXYSeriesCollection dataset)

  Replaces the element at the specified position in the dataset list with the specified element.

  Parameters:
    `datasetNum` - position in the dataset list.
    `dataset` - dataset list.

### getList

    public ArrayList<SSJXYSeriesCollection> getList()

  Returns the dataset list.

  Returns:
    dataset list.

### view

    public JFrame view(int width,
                       int height)

  Displays chart on the screen using Swing. This method creates an application containing a chart panel displaying the chart. The created frame is positioned on-screen, and displayed before it is returned. The `width` and the `height` of the chart are measured in pixels.

  Parameters:
    `width` - frame width in pixels.
    `height` - frame height in pixels.

### enableGrid

    public void enableGrid(double xstep,
                           double ystep)

  Puts grid on the background. It is important to note that the grid is always placed 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 stepping. `xstep` and `ystep` sets the stepping in each direction.

  Parameters:
    `xstep` - sets the stepping in the x-direction.
    `ystep` - sets the stepping in the y-direction.

### disableGrid

    public void disableGrid()

  Disables the background grid.

### toLatex

    public String toLatex(double width,
                          double height)

  Exports the chart to a LATEX source code using PGF/TikZ. This method constructs and returns a string that can be written to a LATEX document to render the plot. `width` and `height` represents the width and the height of the produced chart. These dimensions do not take into account the axes and labels extra space.

  Parameters:
    `width` - Chart's width in centimeters.
    `height` - Chart's height in centimeters.

### setLatexDocFlag

    public void setLatexDocFlag(boolean flag)

  Flag to remove the `\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`.

Overview | Package | Class | Tree | Deprecated | Index | Help
| SSJ V. 2.1.1.
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

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