JFreechart as line or bar (dynamically)

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

JFreechart as line or bar (dynamically)

Post by SNebben » Thu Jul 18, 2002 4:49 pm

I have a ChartPanel that has a JFreechart as:
freeChart = com.jrefinery.chart.ChartFactory.createTimeSeriesChart("Title", "label", "label", new com.jrefinery.data.TimeSeriesCollection(), true);

What I'd like to do is if bar (or vise versa) type is selected, use the current freeChart (without having to access chartpanel) as:
freeChart = null;
freeChart = com.jrefinery.chart.ChartFactory.createVerticalXYBarChart("Title", "label", "label", new com.jrefinery.data.TimeSeriesCollection(), true);

I am missing something because if I try and reassign the freechart to a new chart object, my chartPanel doesn't update. (I am trying to aviod accessing the chart panel as this code is reused in another application that is not a gui).

Thanks for any help/suggestions.
SNebben

Locked