com.approximatrix.charting.model
Class JDBCPlotter

java.lang.Object
  extended by com.approximatrix.charting.model.JDBCPlotter

public class JDBCPlotter
extends java.lang.Object

The class is used to convert database queries into ChartDataModels. You can initialize the Plotter with database parameters and afterwards you can run consecutive queries resulting in a new database.


Field Summary
protected  java.sql.Connection conn
          The SQL connection.
 
Constructor Summary
JDBCPlotter(java.lang.String jdbcDriver, java.lang.String jdbcURL, java.lang.String username, java.lang.String password)
          Creates a new JDBCPlotter using the given driver and URL.
 
Method Summary
 DefaultChartDataModel createChartDataModelInstance(java.lang.String sqlQuery, java.lang.String[] sqlRows)
          Given a SQL query and the row titles this method creates a DefaultChartDataModel.
 DefaultChartDataModel createChartDataModelInstance(java.lang.String sqlQuery, java.lang.String[] sqlRows, java.lang.String[] dataSets)
          Given a SQL query and the row titles this method creates a DefaultChartDataModel.
 DefaultChartDataModel createChartDataModelInstance(java.lang.String sqlQuery, java.lang.String columnRow, java.lang.String[] sqlRows)
          Given a SQL query and the row titles this method creates a DefaultChartDataModel.
 DefaultChartDataModel createChartDataModelInstance(java.lang.String sqlQuery, java.lang.String columnRow, java.lang.String[] sqlRows, java.lang.String[] dataSets)
          Given a SQL query and the row titles this method creates a DefaultChartDataModel.
 ObjectChartDataModel createObjectChartDataModelInstance(java.lang.String sqlQuery, java.lang.String columnRow, java.lang.String[] sqlRows)
          Given a SQL query and the row titles this method creates a ObjectChartDataModel.
 ObjectChartDataModel createObjectChartDataModelInstance(java.lang.String sqlQuery, java.lang.String columnRow, java.lang.String[] sqlRows, java.lang.String[] dataSets)
          Given a SQL query and the row titles this method creates an ObjectChartDataModel.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

conn

protected java.sql.Connection conn
The SQL connection.

Constructor Detail

JDBCPlotter

public JDBCPlotter(java.lang.String jdbcDriver,
                   java.lang.String jdbcURL,
                   java.lang.String username,
                   java.lang.String password)
            throws JDBCPlotterException
Creates a new JDBCPlotter using the given driver and URL.

Parameters:
jdbcDriver - the fully qualified classname of the SQL driver class.
jdbcURL - the URL of the JDBC database to connect to.
username - the username for the JDBC resource
password - the user's password
Throws:
JDBCPlotterException
Method Detail

createChartDataModelInstance

public DefaultChartDataModel createChartDataModelInstance(java.lang.String sqlQuery,
                                                          java.lang.String[] sqlRows)
                                                   throws JDBCPlotterException
Given a SQL query and the row titles this method creates a DefaultChartDataModel. The columns are initialized with values starting from 0.

Parameters:
sqlQuery - the SQL query to be performed
sqlRows - the rows from the ResultSet which should be included in the ChartDataModel and which will be used as the DataSet titles.
Throws:
JDBCPlotterException

createChartDataModelInstance

public DefaultChartDataModel createChartDataModelInstance(java.lang.String sqlQuery,
                                                          java.lang.String[] sqlRows,
                                                          java.lang.String[] dataSets)
                                                   throws JDBCPlotterException
Given a SQL query and the row titles this method creates a DefaultChartDataModel. The columns are initialized with values starting from 0.

Parameters:
sqlQuery - the SQL query to be performed
sqlRows - the rows from the ResultSet which should be included in the ChartDataModel
dataSets - the DataSet titles which should be given to the ChartDataModel instead of the sqlRows titles
Throws:
JDBCPlotterException

createChartDataModelInstance

public DefaultChartDataModel createChartDataModelInstance(java.lang.String sqlQuery,
                                                          java.lang.String columnRow,
                                                          java.lang.String[] sqlRows)
                                                   throws JDBCPlotterException
Given a SQL query and the row titles this method creates a DefaultChartDataModel. The columns are initialized with values from columnRow.

Parameters:
sqlQuery - the SQL query to be performed
columnRow - the row from the ResultSet which should be taken as the column (x-axis) values
sqlRows - the rows from the ResultSet which should be included in the ChartDataModel and which will be used as the DataSet titles.
Throws:
JDBCPlotterException

createChartDataModelInstance

public DefaultChartDataModel createChartDataModelInstance(java.lang.String sqlQuery,
                                                          java.lang.String columnRow,
                                                          java.lang.String[] sqlRows,
                                                          java.lang.String[] dataSets)
                                                   throws JDBCPlotterException
Given a SQL query and the row titles this method creates a DefaultChartDataModel. The columns are initialized with values from columnRow.

Parameters:
sqlQuery - the SQL query to be performed
columnRow - the row from the ResultSet which should be taken as the column (x-axis) values
sqlRows - the rows from the ResultSet which should be included in the ChartDataModel
dataSets - the DataSet titles which should be given to the ChartDataModel instead of the sqlRows titles
Throws:
JDBCPlotterException

createObjectChartDataModelInstance

public ObjectChartDataModel createObjectChartDataModelInstance(java.lang.String sqlQuery,
                                                               java.lang.String columnRow,
                                                               java.lang.String[] sqlRows)
                                                        throws JDBCPlotterException
Given a SQL query and the row titles this method creates a ObjectChartDataModel. The columns are initialized with values from row columnRow.

Parameters:
sqlQuery - the SQL query to be performed
columnRow - the row from the ResultSet which should be taken as the column (x-axis) values
sqlRows - the rows from the ResultSet which should be included in the ChartDataModel and which will be used as the DataSet titles.
Throws:
JDBCPlotterException

createObjectChartDataModelInstance

public ObjectChartDataModel createObjectChartDataModelInstance(java.lang.String sqlQuery,
                                                               java.lang.String columnRow,
                                                               java.lang.String[] sqlRows,
                                                               java.lang.String[] dataSets)
                                                        throws JDBCPlotterException
Given a SQL query and the row titles this method creates an ObjectChartDataModel. The columns are initialized with values of row columnRow.

Parameters:
sqlQuery - the SQL query to be performed
columnRow - the row from the ResultSet which should be taken as the column (x-axis) values
sqlRows - the rows from the ResultSet which should be included in the ChartDataModel
dataSets - the DataSet titles which should be given to the ChartDataModel instead of the sqlRows titles
Throws:
JDBCPlotterException