Hi,
I'm try to plot 2 graphs onto one panel using something like:
JdbcCategoryDataset data1;
JdbcCategoryDataset data2;
data1.executeQuery(referenceQuery);data2.executeQuery(realtimeQuery);
chart.getPlot().setDataset(data1);chart.getPlot().setDataset(data2);
Each chart plots correctly, but not with both series at the same time. Is there a way to have 2 series via the Jdbc interface, or do I have to subclass XYSeries, and fill in the data via an sql query in the subclass?
Maybe I'm missing something here, but I thought about either something like data1.addSeries() or else chart.getSubPlot().
Thanks
Al
Jdbc with 2 series
Re: Jdbc with 2 series
I haven't used the JdbcCategoryDataset class, but looking through the code it looks like the first column of the ResultSet is used for the categories, and columns 2 to n are expected to contain data for n-1 series (the series names are taken from the column names).
You can only set one dataset per plot, so if you need to display more than one series you will have to retrieve all the series in a single query.
Hopefully someone more familiar with JdbcCategoryDataset can give you some more pointers...
Regards,
DG.
You can only set one dataset per plot, so if you need to display more than one series you will have to retrieve all the series in a single query.
Hopefully someone more familiar with JdbcCategoryDataset can give you some more pointers...
Regards,
DG.
Re: Jdbc with 2 series
Al
David is correct in his description of the columns of the sql / resultset. The easiest option if possible is as david suggests, combine into a single query.
BTW what are the queries?
Bryan
David is correct in his description of the columns of the sql / resultset. The easiest option if possible is as david suggests, combine into a single query.
BTW what are the queries?
Bryan
Re: Jdbc with 2 series
Hmmm, not sure that I can combine these queries into one....
First query with data from the last 24 hours:
select to_number(TO_char(BOOKING_TIMESTAMP,'HH24')), count(*) as Count
from DB_BOOKINGS
where BOOKING_TIMESTAMP > (sysdate - 1)
group by to_number(to_char(BOOKING_TIMESTAMP,'HH24'))
order by to_number(to_char(BOOKING_TIMESTAMP,'HH24'))
Second is almost the same. It's the base line for the same data in the previous week.
select to_number(TO_char(BOOKING_TIMESTAMP,'HH24')), count(*) as Reference
from DB_BOOKINGS where BOOKING_TIMESTAMP > (sysdate -
AND BOOKING_TIMESTAMP < (sysdate - 7)
group by to_number(to_char(BOOKING_TIMESTAMP,'HH24'))
order by to_number(to_char(BOOKING_TIMESTAMP,'HH24'))"
First query with data from the last 24 hours:
select to_number(TO_char(BOOKING_TIMESTAMP,'HH24')), count(*) as Count
from DB_BOOKINGS
where BOOKING_TIMESTAMP > (sysdate - 1)
group by to_number(to_char(BOOKING_TIMESTAMP,'HH24'))
order by to_number(to_char(BOOKING_TIMESTAMP,'HH24'))
Second is almost the same. It's the base line for the same data in the previous week.
select to_number(TO_char(BOOKING_TIMESTAMP,'HH24')), count(*) as Reference
from DB_BOOKINGS where BOOKING_TIMESTAMP > (sysdate -

group by to_number(to_char(BOOKING_TIMESTAMP,'HH24'))
order by to_number(to_char(BOOKING_TIMESTAMP,'HH24'))"
Re: Jdbc with 2 series
Another approach would be to write some code that iterates through your two result sets and adds the data to a DefaultCategoryDataset (or your own class that implements the CategoryDataset interface).
Regards,
DG.
Regards,
DG.