Changing axis labels

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
bdw
Advanced
Posts: 130
Joined: Mon Mar 07, 2005 5:00 am
Location: New Zealand
Contact:

Changing axis labels

Post by bdw » Mon May 16, 2005 11:34 pm

Hello,
We have TeeChart Pro V7.05 VCL, what I was wanting to do is display wind direction on a time series chart. In doing so I was wanting to both display 0-360 degrees and also a N,S,W,E label. Is this possible ? I was looking at the TAxisLabelTool component but couldn't find anything in the help file on it ?
TIA,
Brett.

bdw
Advanced
Posts: 130
Joined: Mon Mar 07, 2005 5:00 am
Location: New Zealand
Contact:

Post by bdw » Tue May 17, 2005 12:35 am

Ok, I worked out a way of doing it.....i.e.
TChartAxis *axis = graph_->Axes->Right;
axis->Items->Clear(); // remove all custom labels
// add custom labels
axis->Items->Add(0.0, "N");
...etc...
If there is a better way feel free to comment.
Brett.

Marjan
Site Admin
Site Admin
Posts: 745
Joined: Fri Nov 07, 2003 5:00 am
Location: Slovenia
Contact:

Post by Marjan » Tue May 17, 2005 6:57 am

Hi, Brett.

I think this is the best approach (using custom labels to fully customize axis labels).
Marjan Slatinek,
http://www.steema.com

Keynetix
Newbie
Newbie
Posts: 27
Joined: Thu May 11, 2006 12:00 am
Contact:

Post by Keynetix » Tue May 23, 2006 3:56 pm

Hi Brett,

I am also attempting to plot wind direction charts.

Would it be possible for you to post a full code list for add a custom axis, as it is hard to follow the example you have given.

Many Thanks

James

Keynetix
Newbie
Newbie
Posts: 27
Joined: Thu May 11, 2006 12:00 am
Contact:

Post by Keynetix » Tue May 23, 2006 3:59 pm

Or if anyone has a vb example, Would be fab.

Thanks

James.

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

Post by Narcís » Wed May 24, 2006 7:32 am

Hi James,

I already replied to the message you posted in the ActiveX forum.

Regarding custom labels, you can find an example at TeeChart's features demo. The example can be found at All Features\Welcome!\Axes\Labels\Custom Labels.
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

xxxxxx
Advanced
Posts: 128
Joined: Tue Jun 19, 2007 12:00 am
Location: Russia
Contact:

Re: Changing axis labels

Post by xxxxxx » Tue Jan 29, 2008 9:19 pm

9236183 wrote:I was looking at the TAxisLabelTool component but couldn't find anything in the help file on it ?
TIA,
Brett.
I recently found it's just a demo example of a Custom Chart Tool class located in Examples\Features\TeeAxisLabelTool.pas.

In one of my programs I used

Code: Select all

procedure TForm2.chWGetAxisLabel(Sender: TChartAxis; Series: TChartSeries;
  ValueIndex: Integer; var LabelText: String);
var
  X:double;
  Code:integer;
begin
  if Sender=chW.BottomAxis then
  begin
    Val(LabelText,X,Code);
    if (Round(X)=0) or (Round(X)=360) then
      LabelText:='N'
    else
    if Round(X)=90 then
      LabelText:='E'
    else
    if Round(X)=180 then
      LabelText:='S'
    else
    if Round(X)=270 then
      LabelText:='W'
    else
      Str(X:3:0,LabelText);
  end;
end;
To mee TAxisItems seems interesting but little bit raw (e.g. rendering of 'e' is poor if LabelsExponent=True) and insufficient for the task as suppress drawing of regular labels.
Regards, Alexander
=================
TeeChart Pro v8.05, Delphi 5 & Turbo Delphi Professional for Win32., Delphi & C++Builder 2009

Post Reply