com.quadrique.jbuildingblocks.core.graph
Class JbbGraphXYModel

java.lang.Object
  extended by com.quadrique.jbuildingblocks.core.graph.JbbGraphXYModel
All Implemented Interfaces:
org.jfree.data.Dataset, org.jfree.data.SeriesDataset, org.jfree.data.XYDataset

public class JbbGraphXYModel
extends Object
implements org.jfree.data.Dataset, org.jfree.data.SeriesDataset, org.jfree.data.XYDataset

This class implements the base X-Y model for a JFreeChart graph

Author:
Hervé Rivere

Constructor Summary
JbbGraphXYModel()
          Constructor
 
Method Summary
 void addChangeListener(org.jfree.data.DatasetChangeListener zListener)
          Registers an object for notification of changes to the dataset.
 org.jfree.data.DatasetGroup getGroup()
          get the dataset group.
 int getItemCount(int zSeries)
          Returns the number of X items in the specified series.
 int getSeriesCount()
          Returns the number of series in the data set (i.e.
 String getSeriesName(int zSeries)
          Returns the name of the series (i.e.
 double getX(int i1, int i2)
           
 Number getXValue(int zSeries, int zItem)
          Returns the x-value for the specified series (i.e.
 double getY(int i1, int i2)
           
 Number getYValue(int zSeries, int zItem)
          Returns the y-value for the specified series and item.
 void removeChangeListener(org.jfree.data.DatasetChangeListener zListener)
          Deregisters an object for notification of changes to the dataset.
 void set(ArrayList<Number> zXData, ArrayList<Number>[] zYData, String[] zYSeriesName)
          to set the values of the model
 void setGroup(org.jfree.data.DatasetGroup zGroup)
          Sets the dataset group.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JbbGraphXYModel

public JbbGraphXYModel()
Constructor

Method Detail

addChangeListener

public void addChangeListener(org.jfree.data.DatasetChangeListener zListener)
Registers an object for notification of changes to the dataset.

Specified by:
addChangeListener in interface org.jfree.data.Dataset
Parameters:
zListener - the listener

removeChangeListener

public void removeChangeListener(org.jfree.data.DatasetChangeListener zListener)
Deregisters an object for notification of changes to the dataset.

Specified by:
removeChangeListener in interface org.jfree.data.Dataset
Parameters:
zListener - the listener

set

public void set(ArrayList<Number> zXData,
                ArrayList<Number>[] zYData,
                String[] zYSeriesName)
         throws Exception
to set the values of the model

Parameters:
zXData - the number of X values
zYData - a list of Y values arrays (one array for each serie i.e. one array for each Y line to draw)
zYSeriesName - the name of the Y series
Throws:
Exception - if an error occurs

getItemCount

public int getItemCount(int zSeries)
Returns the number of X items in the specified series. In this inplementation, all series (i.e. all Y curves to draw) have the same number of items

Specified by:
getItemCount in interface org.jfree.data.XYDataset
Parameters:
zSeries - The index (zero-based) of the series;
Returns:
The number of items in the specified series.

getSeriesCount

public int getSeriesCount()
Returns the number of series in the data set (i.e. number of Y lines to draw)

Specified by:
getSeriesCount in interface org.jfree.data.SeriesDataset
Returns:
The number of series in the data source.

getSeriesName

public String getSeriesName(int zSeries)
Returns the name of the series (i.e. Y curve to draw).

Specified by:
getSeriesName in interface org.jfree.data.SeriesDataset
Parameters:
zSeries - The index (zero-based) of the series;
Returns:
The name of the series.

getXValue

public Number getXValue(int zSeries,
                        int zItem)
Returns the x-value for the specified series (i.e. Y curve to draw) and item. Series are numbered 0, 1, ... The implementation is responsible for ensuring that the x-values are presented in ascending order

Specified by:
getXValue in interface org.jfree.data.XYDataset
Parameters:
zSeries - The index (zero-based) of the serie (i.e. Y curve to draw);
zItem - The index (zero-based) of the required item;
Returns:
The x-value for the specified series and item.

getYValue

public Number getYValue(int zSeries,
                        int zItem)
Returns the y-value for the specified series and item. Series are numbered 0, 1, ...

Specified by:
getYValue in interface org.jfree.data.XYDataset
Parameters:
zSeries - The index (zero-based) of the series;
zItem - The index (zero-based) of the required item;
Returns:
The y-value for the specified series and item.

setGroup

public void setGroup(org.jfree.data.DatasetGroup zGroup)
Sets the dataset group.

Specified by:
setGroup in interface org.jfree.data.Dataset
Parameters:
zGroup - the dataset group.

getGroup

public org.jfree.data.DatasetGroup getGroup()
get the dataset group.

Specified by:
getGroup in interface org.jfree.data.Dataset
Returns:
the dataset group.

getX

public double getX(int i1,
                   int i2)
Specified by:
getX in interface org.jfree.data.XYDataset

getY

public double getY(int i1,
                   int i2)
Specified by:
getY in interface org.jfree.data.XYDataset


Copyright © 2001-2008 Quadrique Corporation. All Rights Reserved.