ChartPanel,Chart setOpaque() ???

A discussion forum for JFreeChart (a 2D chart library for the Java platform).
Locked
Joachim Bäck

ChartPanel,Chart setOpaque() ???

Post by Joachim Bäck » Mon May 06, 2002 10:58 am

hi,
Im using JFreeChart ver.0.8.1 to display a pie chart in my app.
The panel where I add all "child" panels overrides the painComponent method and paints a Gradient Paint. The child panels are all setOpaque(false) so that I have the same "background" paint over all panels.
The problem is that when i create a ChartPanel and call setOpaque(false) the background of the panel still gets painted.
And when I set the backgroundPaint of the PiePlot to null the background color of the PiePlot is like the DefaultColor of the ChartPanel.
I dont know if there is a similar method in ChartPanel or Chart (->PiePlot) to get the effect of setOpaque(false) called on JPanels.

Thakns,
Joachim

David Gilbert

Re: ChartPanel,Chart setOpaque() ???

Post by David Gilbert » Tue May 07, 2002 9:21 am

There's a background paint for the chart as well as the plot...so perhaps you need to call setBackgroundPaint(null) on the JFreeChart instance also...

Regards,

DG.

Joachim Bäck

Re: ChartPanel,Chart setOpaque() ???

Post by Joachim Bäck » Tue May 07, 2002 7:53 pm

hi
thanks for the response, I've tried to call setBackgroundPaint(null) on the JFreeChart instance to but I didn't got the effect of setOpaqu(false).
The problem with the background color was still the same and the labels of the the piechart dont get erased when updating the dataset (only after resizing the panel).
But I found a solution witch works for me.
The problem was the BufferedImage in the paintComponent() method of JFreeChartPanel.
Now I subclassed JFreeChartPanel and draw direct in the Graphics context.
I think it's dirty but it works fine :-)

Joachim

Locked