hide the series legend?

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

hide the series legend?

Post by Phillip Rhodes » Mon Apr 02, 2001 6:49 am

Is there a way to hide the series legend?

David Gilbert

RE: hide the series legend?

Post by David Gilbert » Tue Apr 03, 2001 12:26 pm

You should be able to use:

yourChart.setLegend(null);

There is a bug (id=232915) in the demo application where attempting to use the chart property editor fails if the legend is null, but this won't affect you if you are not using the property editor in your application.

Regards,

DG.

Morten Jeppesen

RE: hide the series legend?

Post by Morten Jeppesen » Tue May 08, 2001 11:36 am

I kind of have the same problem in the servlet demo..

I've tried to use the setLegend method on the piechart as follows:

<< FreeChartServlet.java >>

protected JFreeChart createChart(int type, int initGradColor, int finalGradColor)
.
..

case 6:
categoryData = createCategoryDataSource();
chart = JFreeChart.createPieChart(categoryData);
chart.setChartBackgroundPaint(new GradientPaint(0, 0, getColor
(initGradColor), 1000, 0, getColor( finalGradColor )));
chart.setLegend(null);
return chart;

..
.

this returns a nullpointerexeption from the draw method in pieplot..

Unfortunatly, I think the draw method in pieplot is very hard to understand, so I can easily have missed the problem..

Hope U can help me.

Morten

Locked