|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.jfree.data.general.AbstractDataset
org.jfree.data.general.AbstractSeriesDataset
org.jfree.data.xy.AbstractXYDataset
org.jfree.data.jdbc.JDBCXYDataset
This class provides an XYDataset
implementation over a database JDBC result set.
The dataset is populated via a call to executeQuery with the string sql query.
The sql query must return at least two columns. The first column will be
the x-axis and remaining columns y-axis values.
executeQuery can be called a number of times.
The database connection is read-only and no write back facility exists.
Constructor Summary | |
JDBCXYDataset(java.sql.Connection con)
Creates a new dataset (initially empty) using the specified database connection. |
|
JDBCXYDataset(java.sql.Connection con,
java.lang.String query)
Creates a new dataset using the specified database connection, and populates it using data obtained with the supplied query. |
|
JDBCXYDataset(java.lang.String url,
java.lang.String driverName,
java.lang.String user,
java.lang.String password)
Creates a new dataset (initially empty) and establishes a new database connection. |
Method Summary | |
void |
close()
Close the database connection |
void |
executeQuery(java.sql.Connection con,
java.lang.String query)
ExecuteQuery will attempt execute the query passed to it against the provided database connection. |
void |
executeQuery(java.lang.String query)
ExecuteQuery will attempt execute the query passed to it against the existing database connection. |
int |
getItemCount()
Returns the number of items in all series. |
int |
getItemCount(int seriesIndex)
Returns the number of items in the specified series. |
int |
getLegendItemCount()
Returns the number of items that should be displayed in the legend. |
java.lang.String[] |
getLegendItemLabels()
Returns the legend item labels. |
Range |
getRangeBounds(boolean includeInterval)
Returns the range of the values in this dataset's range. |
double |
getRangeLowerBound(boolean includeInterval)
Returns the minimum y-value in the dataset. |
double |
getRangeUpperBound(boolean includeInterval)
Returns the maximum y-value in the dataset. |
int |
getSeriesCount()
Returns the number of series in the dataset. |
java.lang.String |
getSeriesName(int seriesIndex)
Returns the name of the specified series. |
java.lang.Number |
getX(int seriesIndex,
int itemIndex)
Returns the x-value for the specified series and item. |
java.lang.Number |
getY(int seriesIndex,
int itemIndex)
Returns the y-value for the specified series and item. |
boolean |
isTimeSeries()
Returns true if the dataset represents time series data, and false
otherwise. |
void |
setTimeSeries(boolean timeSeries)
Sets a flag that indicates whether or not the data represents a time series. |
Methods inherited from class org.jfree.data.xy.AbstractXYDataset |
getDomainOrder, getXValue, getYValue |
Methods inherited from class org.jfree.data.general.AbstractSeriesDataset |
seriesChanged |
Methods inherited from class org.jfree.data.general.AbstractDataset |
addChangeListener, clone, fireDatasetChanged, getGroup, notifyListeners, removeChangeListener, setGroup, validateObject |
Methods inherited from class java.lang.Object |
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface org.jfree.data.xy.XYDataset |
getDomainOrder, getXValue, getYValue |
Methods inherited from interface org.jfree.data.general.Dataset |
addChangeListener, getGroup, removeChangeListener, setGroup |
Constructor Detail |
public JDBCXYDataset(java.lang.String url, java.lang.String driverName, java.lang.String user, java.lang.String password) throws java.sql.SQLException, java.lang.ClassNotFoundException
url
- URL of the database connection.driverName
- the database driver class name.user
- the database user.password
- the database user's password.
java.lang.ClassNotFoundException
- if the driver cannot be found.
java.sql.SQLException
- if there is a problem connecting to the database.public JDBCXYDataset(java.sql.Connection con) throws java.sql.SQLException
con
- the database connection.
java.sql.SQLException
- if there is a problem connecting to the database.public JDBCXYDataset(java.sql.Connection con, java.lang.String query) throws java.sql.SQLException
con
- the connection.query
- the SQL query.
java.sql.SQLException
- if there is a problem executing the query.Method Detail |
public boolean isTimeSeries()
true
if the dataset represents time series data, and false
otherwise.
public void setTimeSeries(boolean timeSeries)
timeSeries
- the new value of the flag.public void executeQuery(java.lang.String query) throws java.sql.SQLException
query
- the query to be executed.
java.sql.SQLException
- if there is a problem executing the query.public void executeQuery(java.sql.Connection con, java.lang.String query) throws java.sql.SQLException
query
- the query to be executed.con
- the connection the query is to be executed against.
java.sql.SQLException
- if there is a problem executing the query.public java.lang.Number getX(int seriesIndex, int itemIndex)
getX
in interface XYDataset
seriesIndex
- The series (zero-based index).itemIndex
- The item (zero-based index).
XYDataset
public java.lang.Number getY(int seriesIndex, int itemIndex)
getY
in interface XYDataset
seriesIndex
- The series (zero-based index).itemIndex
- The item (zero-based index).
XYDataset
public int getItemCount(int seriesIndex)
getItemCount
in interface XYDataset
seriesIndex
- The series (zero-based index).
XYDataset
public int getItemCount()
TableXYDataset
interface.
getItemCount
in interface TableXYDataset
public int getSeriesCount()
getSeriesCount
in interface SeriesDataset
getSeriesCount
in class AbstractSeriesDataset
XYDataset
,
Dataset
public java.lang.String getSeriesName(int seriesIndex)
getSeriesName
in interface SeriesDataset
getSeriesName
in class AbstractSeriesDataset
seriesIndex
- The series (zero-based index).
XYDataset
,
Dataset
public int getLegendItemCount()
public java.lang.String[] getLegendItemLabels()
public void close()
public double getRangeLowerBound(boolean includeInterval)
getRangeLowerBound
in interface RangeInfo
includeInterval
- a flag that determines whether or not the
y-interval is taken into account.
public double getRangeUpperBound(boolean includeInterval)
getRangeUpperBound
in interface RangeInfo
includeInterval
- a flag that determines whether or not the
y-interval is taken into account.
public Range getRangeBounds(boolean includeInterval)
getRangeBounds
in interface RangeInfo
includeInterval
- a flag that determines whether or not the
y-interval is taken into account.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |