Custom drawing getting painted over
Posted: 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?
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?