X Axis display K(kilo), M(Mega) ,G(Giga) T(Terra)

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
Herman
Newbie
Newbie
Posts: 56
Joined: Tue Dec 07, 2004 5:00 am

X Axis display K(kilo), M(Mega) ,G(Giga) T(Terra)

Post by Herman » Tue Dec 20, 2005 1:47 am

How to write the BottomAxis->AxisValuesFormat so it can display:
ex: 1200 to 1.2K, 15000 to 15K, 2500000 to 2.5M, etc

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Tue Dec 20, 2005 1:23 pm

Hi Herman,

You need to do it manually in TChart's GetAxisLabel event. A similar example would be:

Code: Select all

procedure TForm1.Chart1GetAxisLabel(Sender: TChartAxis;
  Series: TChartSeries; ValueIndex: Integer; var LabelText: String);
begin
var tmp : Double;
begin
    if Sender = Char1.Axes.Bottom then
    begin
        tmp := StrToFloat(LabelText);
        tmp := 1.0 - 1.0/(Exp(Exp(tmp)));
        LabelText:=FormatFloat(Chart.LeftAxis.AxisValuesFormat,tmp);
    end;
end;
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

Post Reply