Class JDBCMultiCategoryDataset
java.lang.Object
org.jfree.data.general.AbstractDataset
org.jfree.data.category.DefaultCategoryDataset
org.jfree.data.jdbc.JDBCCategoryDataset
net.simplace.ui.jfreechart.JDBCMultiCategoryDataset
- All Implemented Interfaces:
ObjectInputValidation, Serializable, Cloneable, org.jfree.chart.util.PublicCloneable, org.jfree.data.category.CategoryDataset, org.jfree.data.general.Dataset, org.jfree.data.KeyedValues2D, org.jfree.data.Values2D
public class JDBCMultiCategoryDataset
extends org.jfree.data.jdbc.JDBCCategoryDataset
This is an enhanced version of the JFreeChart
JDBCCategoryDataset class.
While the JFreeChart class expects the associated SQL statement to return a separate numerical column for every series,
this class also handles statements that return 3 columns:
two VARCHAR columns that contain the category's and series' names and a single numerical column that contains the values.
If a statement returns three columns as described above, the second column will be interpreted as series names. Otherwise,
this class will return the same result as the JFreeChart implementation.- Author:
- Andreas Enders, ckunze
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionJDBCMultiCategoryDataset(Connection aConnection) Creates a new emptyCategoryDatasetwith the given connection.JDBCMultiCategoryDataset(Connection aConnection, String aQuery) Creates aCategoryDatasetand initializes it with the values returned by the specified SQL query. -
Method Summary
Modifier and TypeMethodDescriptionvoidexecuteQuery(Connection aConnection, String aQuery) Fills the dataset with the data returned by the specified query.Methods inherited from class org.jfree.data.jdbc.JDBCCategoryDataset
executeQuery, getTranspose, setTransposeMethods inherited from class org.jfree.data.category.DefaultCategoryDataset
addValue, addValue, clear, clone, equals, getColumnCount, getColumnIndex, getColumnKey, getColumnKeys, getRowCount, getRowIndex, getRowKey, getRowKeys, getValue, getValue, hashCode, incrementValue, removeColumn, removeColumn, removeRow, removeRow, removeValue, setValue, setValueMethods inherited from class org.jfree.data.general.AbstractDataset
addChangeListener, canEqual, fireDatasetChanged, getGroup, getNotify, hasListener, notifyListeners, removeChangeListener, setGroup, setNotify, validateObjectMethods inherited from class Object
finalize, getClass, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.jfree.data.general.Dataset
addChangeListener, getGroup, removeChangeListener, setGroup
-
Constructor Details
-
JDBCMultiCategoryDataset
Creates aCategoryDatasetand initializes it with the values returned by the specified SQL query. Please refer to this class's description for more information on how columns in the result set are translated to categories and series.- Parameters:
aConnection- the database connectionaQuery- the query- Throws:
SQLException- if the query fails or returns less than 2 columns
-
JDBCMultiCategoryDataset
Creates a new emptyCategoryDatasetwith the given connection.- Parameters:
aConnection- the database connection
-
-
Method Details
-
executeQuery
Fills the dataset with the data returned by the specified query. Please refer to this class's description for more information on how columns in the result set are translated to categories and series.- Overrides:
executeQueryin classorg.jfree.data.jdbc.JDBCCategoryDataset- Parameters:
aConnection- the database connectionaQuery- the query- Throws:
SQLException- if the query fails or returns less than 2 columns
-