org.jfree.data.jdbc
Class JDBCXYDataset
- Cloneable, Dataset, EventListener, ObjectInputValidation, RangeInfo, Serializable, SeriesChangeListener, SeriesDataset, TableXYDataset, XYDataset
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.
JDBCXYDataset(Connection con) - Creates a new dataset (initially empty) using the specified database
connection.
|
JDBCXYDataset(Connection con, String query) - Creates a new dataset using the specified database connection, and
populates it using data obtained with the supplied query.
|
JDBCXYDataset(String url, String driverName, String user, String password) - Creates a new dataset (initially empty) and establishes a new database
connection.
|
void | close() - Close the database connection
|
void | executeQuery(Connection con, String query) - ExecuteQuery will attempt execute the query passed to it against the
provided database connection.
|
void | executeQuery(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() - This method is not used in JFreeChart 1.0.x (it was left in
the API by mistake and is officially deprecated from version 1.0.3
onwards).
|
String[] | getLegendItemLabels() - This method is not used in JFreeChart 1.0.x (it was left in
the API by mistake and is officially deprecated from version 1.0.3
onwards).
|
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.
|
Comparable | getSeriesKey(int seriesIndex) - Returns the key for the specified series.
|
Number | getX(int seriesIndex, int itemIndex) - Returns the x-value for the specified series and item.
|
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.
|
JDBCXYDataset
public JDBCXYDataset(Connection con)
throws SQLException
Creates a new dataset (initially empty) using the specified database
connection.
con
- the database connection.
JDBCXYDataset
public JDBCXYDataset(Connection con,
String query)
throws SQLException
Creates a new dataset using the specified database connection, and
populates it using data obtained with the supplied query.
con
- the connection.query
- the SQL query.
JDBCXYDataset
public JDBCXYDataset(String url,
String driverName,
String user,
String password)
throws SQLException,
ClassNotFoundException
Creates a new dataset (initially empty) and establishes a new database
connection.
url
- URL of the database connection.driverName
- the database driver class name.user
- the database user.password
- the database user's password.
close
public void close()
Close the database connection
executeQuery
public void executeQuery(Connection con,
String query)
throws SQLException
ExecuteQuery will attempt execute the query passed to it against the
provided database connection. If connection is null then no action is
taken.
The results from the query are extracted and cached locally, thus
applying an upper limit on how many rows can be retrieved successfully.
con
- the connection the query is to be executed against.query
- the query to be executed.
executeQuery
public void executeQuery(String query)
throws SQLException
ExecuteQuery will attempt execute the query passed to it against the
existing database connection. If no connection exists then no action
is taken.
The results from the query are extracted and cached locally, thus
applying an upper limit on how many rows can be retrieved successfully.
query
- the query to be executed.
getItemCount
public int getItemCount(int seriesIndex)
Returns the number of items in the specified series.
- getItemCount in interface XYDataset
seriesIndex
- the series (zero-based index).
getLegendItemCount
public int getLegendItemCount()
This method is not used in JFreeChart 1.0.x (it was left in
the API by mistake and is officially deprecated from version 1.0.3
onwards).
Returns the number of items that should be displayed in the legend.
- The legendItemCount value
getLegendItemLabels
public String[] getLegendItemLabels()
This method is not used in JFreeChart 1.0.x (it was left in
the API by mistake and is officially deprecated from version 1.0.3
onwards).
Returns the legend item labels.
getRangeBounds
public Range getRangeBounds(boolean includeInterval)
Returns the range of the values in this dataset's range.
- getRangeBounds in interface RangeInfo
includeInterval
- a flag that determines whether or not the
y-interval is taken into account.
getRangeLowerBound
public double getRangeLowerBound(boolean includeInterval)
Returns the minimum y-value in the dataset.
- getRangeLowerBound in interface RangeInfo
includeInterval
- a flag that determines whether or not the
y-interval is taken into account.
getRangeUpperBound
public double getRangeUpperBound(boolean includeInterval)
Returns the maximum y-value in the dataset.
- getRangeUpperBound in interface RangeInfo
includeInterval
- a flag that determines whether or not the
y-interval is taken into account.
getX
public Number getX(int seriesIndex,
int itemIndex)
Returns the x-value for the specified series and item. The
implementation is responsible for ensuring that the x-values are
presented in ascending order.
- getX in interface XYDataset
seriesIndex
- the series (zero-based index).itemIndex
- the item (zero-based index).
getY
public Number getY(int seriesIndex,
int itemIndex)
Returns the y-value for the specified series and item.
- getY in interface XYDataset
seriesIndex
- the series (zero-based index).itemIndex
- the item (zero-based index).
isTimeSeries
public boolean isTimeSeries()
Returns true
if the dataset represents time series data,
and false
otherwise.
setTimeSeries
public void setTimeSeries(boolean timeSeries)
Sets a flag that indicates whether or not the data represents a time
series.
timeSeries
- the new value of the flag.