Custom Labels problem

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
Metman
Advanced
Posts: 113
Joined: Fri Dec 21, 2007 12:00 am

Custom Labels problem

Post by Metman » Mon Feb 27, 2012 4:09 pm

Hi

Another simple question - I am adding custom labels to the right axis of a chart I have created. The left axis is displaying rainfall in millimeters and the right hand axis is displaying the values in inches. I copied your example from the demo program and it works fine but not the first time it displays. It works fine the second and subsequent times I use it.

I call the procedure after I have plotted the graph and set the extents of the axis. I have tried placing a chart.refresh or chart.update before calling my addlabels procedure but with no luck. When I add a break point inside the procedure I notice that properties such as chart.Axes.Right.Maximum have zero values when they should have much higher ones. I use this value to work out how many values I need to plot labels for. Can you suggest a solution?

Bruce.

Metman
Advanced
Posts: 113
Joined: Fri Dec 21, 2007 12:00 am

Re: Custom Labels problem

Post by Metman » Mon Feb 27, 2012 4:21 pm

Hi

I think the problem is that I should be adding custom labels using the OnAfterDraw event and not after I have just filled them.

Bruce.

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

Re: Custom Labels problem

Post by Yeray » Tue Feb 28, 2012 4:13 pm

Hi Bruce,
Metman wrote:I think the problem is that I should be adding custom labels using the OnAfterDraw event and not after I have just filled them.
Right, it will probably be something like that. Note that some properties need the chart to have finished the drawing process to have valid values. If you are using some of these properties, you could force a chart repaint before using them.
The OnAfterDraw event could be a solution, but note using it may not be the most efficient solution.
Instead of that, you could call the Draw() method to force the chart repaint, and then place your custom labels once.
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

Post Reply