Board index » delphi » HELP! - TeeChart 4.0 axis labels

HELP! - TeeChart 4.0 axis labels

Hi,

I am developing an application which uses TeeChart 4.0 to display text
labels on
the Y-axis.  I am using OnGetAxisLabel and OnGetNextAxisLabel events to
draw
these labels.  What I need to do is recalculate the label locations every
time
the chart is rescaled.  I have tried to use Chart.LeftAxis.CalcYPosValue to
find
the pixel locations, but I keep getting 0 for the returned values.  Is
there something
I'm missing?

Thanks for any help,

Mark Vinogradov
ObjectWorks.com

 

Re:HELP! - TeeChart 4.0 axis labels


Hi.

Here is an example how I redraw each label. Hope this works for you too.
This procedure recalculates values on right axis so I can get Celsius
degrees from Fahrenheit degrees.

procedure TForm1.DBChart1GetAxisLabel(Sender: TChartAxis;
  Series: TChartSeries; ValueIndex: Integer; var LabelText: String);

var F,C:Real;
  begin
     If Sender=DBChart1.RightAxis then begin
        F:=StrToFloat(LabelText);  // Fahrenheit degrees
        C:=5*(F-32)/9;  // Now recalculate for Celsius
        LabelText:=FormatFloat('#0.0',C);  // Rewrite label with Celsius
     end;
end;

Quote
mark vinogradov wrote in message <01be11af$c5d0d860$1d010ac0@mvinogradov>...
>Hi,

>I am developing an application which uses TeeChart 4.0 to display text
>labels on
>the Y-axis.  I am using OnGetAxisLabel and OnGetNextAxisLabel events to
>draw
>these labels.  What I need to do is recalculate the label locations every
>time
>the chart is rescaled.  I have tried to use Chart.LeftAxis.CalcYPosValue to
>find
>the pixel locations, but I keep getting 0 for the returned values.  Is
>there something
>I'm missing?

>Thanks for any help,

>Mark Vinogradov
>ObjectWorks.com

Other Threads