change of renderer properties and automatic repaint in 0.0.6

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

change of renderer properties and automatic repaint in 0.0.6

Post by Martin Goebel » Mon Feb 24, 2003 12:03 pm

Hi,

I want the user to interactively change attributes of my chart.
Performing changes on the plot
(e.g. XYScatterProfilePanel.this.chart.getXYPlot().setDomainGridlinesVisible(showDomainGrids) shows the change automatically (as expected).

Now, to perform changes on properties belonging to the renderer (e.g. if the shapes of my XYPlot are to be drawn or not), I say
((StandardXYItemRenderer)XYScatterProfilePanel.this.chart.getXYPlot().getRenderer()).setPlotShapes(showPoints);

Why doesn't this call result in an automatic update of my chart so that the changes can be seen at once (although setPlotShapes fires a PropertyChangeEvent)?

Martin

Martin Goebel

Re: change of renderer properties and automatic repaint in 0

Post by Martin Goebel » Mon Feb 24, 2003 12:04 pm

Sorry, of course I wanted to say "0.9.6" in the subject

Eduardo Ramalho

Re: change of renderer properties and automatic repaint in 0

Post by Eduardo Ramalho » Mon Feb 24, 2003 1:25 pm

Hi Martin!

Try:

StandardXYItemRenderer xyrenderer =
((StandardXYItemRenderer).getXYPlot().getRenderer()).setPlotShapes(showPoints);

XYScatterProfilePanel.this.chart.getChart().getXYPlot().setRenderer(xyrenderer);

Eduardo

Martin Goebel

Re: change of renderer properties [...] does not work

Post by Martin Goebel » Mon Feb 24, 2003 3:30 pm

Hi Eduardo,

thanks for your quick answer.

So here is what I tried:
StandardXYItemRenderer xyRenderer = (StandardXYItemRenderer)XYScatterProfilePanel.this.chart.getXYPlot().getRenderer();
xyRenderer.setPlotShapes(showPoints);
XYScatterProfilePanel.this.chart.getXYPlot().setRenderer(xyRenderer);

Unfortunately, it does not work - the xyRenderer is still a reference to the same old XYRenderer object, so setRenderer() does not create PlotChangeEvent.

But anyway, I thought that setPlotShapes() would have to do the update without extra work (like method calls on the plot do), or am I wrong here?
It does not seem logical to me that I have to create a PlotChangeEvent on my own. Am I missing something?

Martin

Locked