How to set up the legend of an IntervalXYDataset...

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

How to set up the legend of an IntervalXYDataset...

Post by Mat » Tue Jun 25, 2002 4:22 pm

Hi,

I implemented an IntervalXYDataset for a verticalXYBarchart...
but I do not know how i can set up the legend of the serie... Actually I have "Series 1 " with a red square. I would like to change "Series 1"

*****************************************
IntervalXYDataset categoryData = new SimpleIntervalXYDataset( Time, XValues, YValues);

JFreeChart chart = ChartFactory.createVerticalXYBarChart(YLabel.concat(" "+Title), XLabel, YLabel ,categoryData, true);
XYPlot bPlot = chart.getXYPlot();

VerticalNumberAxis yAxis = (VerticalNumberAxis)bPlot.getVerticalAxis();
yAxis.setRange(Ymin,Ymax);
bPlot.setDomainAxis(new HorizontalNumberAxis(XLabel, new Font("Button_Font", Font.PLAIN , 12), Xmin, Xmax));
*****************************************

Thanks
Mat

David Gilbert

Re: How to set up the legend of an IntervalXYDataset...

Post by David Gilbert » Tue Jun 25, 2002 11:52 pm

The legend displays the series names, so the only way (at present) to change the text in the legend is to change the names of the series returned by your dataset. Note that SimpleIntervalXYDataset is a quick hack for demo purposes...everything in it is hard coded. You will need to write your own class that implements the IntervalXYDataset interface.

Regards,

DG.

Locked