adding null data to DefaultCategoryDataset.

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

adding null data to DefaultCategoryDataset.

Post by Stacey » Tue Jan 28, 2003 4:46 pm

Is there a way to add a null (data) series to an instance of DefaultCategoryDataset?

For instance, I have 2 series, only one has data, the other is null for all categories. I would like the legend to still show there are 2 series associated with the chart.

Thanks,
Stacey

David Gilbert

Re: adding null data to DefaultCategoryDataset.

Post by David Gilbert » Wed Jan 29, 2003 12:23 am

Hi Stacey,

If your dataset returns null for all categories in a particular series, that series should still show up in the legend.

The current implementation of DefaultCategoryDataset isn't very flexible...in the upcoming 0.9.5 release, this class has been rewritten to allow better manipulation of the data content.

Regards,

Dave Gilbert

Stacey

Re: adding null data to DefaultCategoryDataset.

Post by Stacey » Wed Jan 29, 2003 3:31 pm

Thanks for your reply David,

I am working with the CVS repository latest (as of 1/28).
I probably didn't specify my question the best, but the series I would like to be viewable actually doesn't have any categories either (at least none defined for a particular set). Therefor, the only information I have for that serie is that there is one. There are no categories or values to specify for it. I believe what I need is a way to add a series to the dataset but only using the serie "Name". The only way I have determined to add a serie is using the method(s)

addValue(Value, serie, category); // or setValue(...)

Using this implementation, a value and category must exist to add new serie information.

I very well could be missing something though.
Thanks again for your time.
Stacey

David Gilbert

Re: adding null data to DefaultCategoryDataset.

Post by David Gilbert » Thu Jan 30, 2003 12:54 am

Hi Stacey,

I haven't had a chance to try it yet, but what happens if you do:

addValue(null, "MySeries", "MyCategory");

I would expect that to add a new series that appears in the legend but not on the chart...

Regards,

Dave Gilbert

Locked