Apparent bug in plot

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

Apparent bug in plot

Post by Bebe » Thu Sep 07, 2000 11:00 pm

The Plot class does not appear to register itself as a listener of the DataSource class, which means that when the data changes the chart does not automatically update. This is true for the XYPlot at least, but it appears to be true for all the Plot types, since I would imagine that the listener registration should happen in the base Plot class. This problem can be worked around by adding the following code in user code:

// HACK: Necessary to make chart change when data updates (should be fixed in chart code)

I know that the chart used to update when the data changed (in previous versions of the chart code), so I would imagine that somehow that code was accidentally deleted. Otherwise the chart looks pretty good!

There is one other problem (which can also be worked around), which is that the right side of the chart goes right up against the edge if the panel when there is no legend. The top of the chart looks good when there is no title, but the chart edge should be buffered when the legend has been removed (by passing null to setLegend()). The workaround is to set insets:

Plot chartPlot = chart.getPlot();
chartPlot.setInsets(new Insets(0, 0, 0, 3));

but again longer-term this should be fixed in the chart code.

David Gilbert

RE: Apparent bug in plot

Post by David Gilbert » Wed Sep 13, 2000 11:13 pm


Thanks for the feedback. I'll get these problems fixed for the next version...



Post Reply