to check when the data is not available

A discussion forum for JFreeChart (a 2D chart library for the Java platform).
Locked
RaviTeja

to check when the data is not available

Post by RaviTeja » Sat Jun 01, 2002 7:23 am

hello everybody.


i hope someone can get me an idea to solve this problem i'm facing.
i'm trying to generate a intraday chart (time series ).
as my data is present in the database ,i need to fetch it from the database and plot the graph.i established the database connection in the demodataset factory

my graph represents the performance of a single scrip in the stock market.as some of the scrips may not be traded, due the poor demand or some other reasons, data may not be available in the database when this situation arises.at this point i want to check for this condition and display the message "data not available".

what i tried to do:

XYDataset xyData1 = DemoDatasetFactory.createTimeSeriesCollection3(str);
after creating the object for the XYDataset i tried to check whether it is null or not.if not i'm generating the graph else return null.
but this xyData1 object will never be null.here is the problem now.
even when the data is not present the program is taking some values in the x-axis and y-axis and displaying the chart without the plot.

i also tried to check in the database connection(in the demodataset factory) but the method present here is returning a object of basictimeseries class.and this is also helpless.

note:in the "createTimeSeriesCollectio3(str)" method present in the demodatasetfactory class i have the database conection.


i hope i'm clear.
i hope someone can get me a solution for this.

thankng u in advance.

regards
ravi teja

David Gilbert

Re: to check when the data is not available

Post by David Gilbert » Sun Jun 02, 2002 6:14 am

You could try the getSeriesCount() method and if it returns zero, there is no data. Or modify your method that creates the dataset to return null when there is no data available in the database.

RaviTeja

Re: to check when the data is not available

Post by RaviTeja » Sun Jun 02, 2002 8:39 am

hello David,


thanks for the reply.
david,
i tried with the getSeriesCount() method.
the output is same when the data is present and when the data is not present.here for my program the output is 1.
i guess,even when the data is not present as the image of the graph is being created without the plot, the getSeriesCount() method is returning the same value.
Is there any method which will identify whether the object of xyDataSet contains data or not.
thanking u once again for all the support u have extended to me.


regards
ravi teja

Locked