Page 1 of 1

Custom drawing getting painted over

Posted: Tue May 10, 2011 7:49 pm
by 15359204
I'm using TeeCharts for Java with eclipse. I need to draw some custom labels on my chart. I implemented the chart paint listener chart painted method which is supposed to let me draw after my chart has been painted, but it is not working. If I set a breakpoint in the listener it does hit it, and I can see my custom text and then there is a small delay and the chart gets redrawn without my custom text. Here's my code:

chart1.addChartPaintListener( new ChartPaintAdapter() {
public void seriesPainted(ChartDrawEvent e) {
chart1.getGraphics().drawString("Label 1", 20, 20);
};
public void chartPainted(ChartDrawEvent e) {
chart1.getGraphics().drawString("Label 2", 10, 10);
};
});

I overwrote the series and chart painted methods to try to get one to work. I tried with auto paint on the chart true and false, manually calling the paint, but it made no difference. My chart is nested in some panels, but I don't see how this could affect the painting. What am I doing wrong?

Re: Custom drawing getting painted over

Posted: Fri May 13, 2011 2:01 pm
by yeray
Hello mts,

The attached project seems to work fine for me here with TeeChart Java v2. Could you please check it? (Use import option in eclipse)
Eclipse_TestProject.zip
(3.52 KiB) Downloaded 1056 times
If it works for you, the problem might be caused by some particular setting in your application. If that's the case, please, try to arrange a simple example project we can run as-is to reproduce the problem here.

Re: Custom drawing getting painted over

Posted: Fri Jul 22, 2011 7:51 pm
by 15359204
I still cannot get it to work, though your example works fine. I was able to draw lines on the chart, but when I try to draw labels in the margins it doesn't refresh right, not sure why. Instead I just placed JLabels at the top of my chart to display the information I needed.