Custom drawing getting painted over

TeeChart for Java (NetBeans, Eclipse, Android Studio, etc)
Post Reply
mts
Newbie
Newbie
Posts: 18
Joined: Fri Apr 29, 2011 12:00 am

Custom drawing getting painted over

Post by mts » Tue May 10, 2011 7:49 pm

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?

Yeray
Site Admin
Site Admin
Posts: 9613
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

Re: Custom drawing getting painted over

Post by Yeray » Fri May 13, 2011 2:01 pm

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 1055 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.
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

mts
Newbie
Newbie
Posts: 18
Joined: Fri Apr 29, 2011 12:00 am

Re: Custom drawing getting painted over

Post by mts » Fri Jul 22, 2011 7:51 pm

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.

Post Reply