skipping the date which does not have data?

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

skipping the date which does not have data?

Post by Deepak Bhatt » Mon Jan 20, 2003 4:54 pm

Hi,

I am using XYPlot and a series dataset that is implementing XYDataset,CategoryDataset,IntervalXYDataset interfaces
I am plotting 3 line graphs in XY plot.
I am using HorizontalDateAxis for the X axis .

Now SeriesDataset is implemented in such a way that If it does not have data for a particular date then it returns 'null'.Due to this I amgetting gaps in between the lines and not getting the continuous lines.

Can I do something like , if there is no data for a particular date then skip that Date.
If I skip that Date then I will get a continuous line.

Any pointers would be of great help.

My code is as follows.
--------------------------------------------------------------------------------------
private void createChart(List list) {

HorizontalDateAxis haxis = new HorizontalDateAxis("Zeit");
SeriesDataset dataset = new SeriesDataset(list, SeriesDataset.PRICE);
dataset.setDateFormat(DateFormat.DAILY);
XYStepRenderer renderer = new XYStepRenderer();
VerticalNumberAxis vAxis = new VerticalNumberAxis("%");
XYPlot plot = new XYPlot(dataset, haxis, vAxis, renderer );
setChart(new JFreeChart("", JFreeChart.DEFAULT_TITLE_FONT, plot, true) );
}
--------------------------------------------------------------------------------------

Thanks in Advance,
Deepak.

David Gilbert

Re: skipping the date which does not have data?

Post by David Gilbert » Mon Jan 20, 2003 6:26 pm

Hi Deepak,

The code is set up to draw a discontinuous line if there is a null value. You need to modify your dataset so that it only returns (date, value) pairs where there actually is data. Note that there is no requirement for the date values to be evenly spaced, you can return data at irregular points if you need to.

Regards,

Dave Gilbert

Deepak Bhatt

Re: skipping the date which does not have data?

Post by Deepak Bhatt » Tue Jan 21, 2003 9:58 am

Hi Dave,

Thank you very much Dave...
I will give it a try now :))

Regards,
Deepak.

Deepak Bhatt

Re: skipping the date which does not have data?

Post by Deepak Bhatt » Wed Jan 22, 2003 3:58 pm

Hi,

I made a new dataset that returns (date,value).
It worked perfactly fine.

Thanks agin..

Regards,
Deepak.

Locked