Page 1 of 1
Changing axis labels
Posted: Mon May 16, 2005 11:34 pm
by 9236183
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.
Posted: Tue May 17, 2005 12:35 am
by 9236183
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.
Posted: Tue May 17, 2005 6:57 am
by Marjan
Hi, Brett.
I think this is the best approach (using custom labels to fully customize axis labels).
Posted: Tue May 23, 2006 3:56 pm
by 9531278
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
Posted: Tue May 23, 2006 3:59 pm
by 9531278
Or if anyone has a vb example, Would be fab.
Thanks
James.
Posted: Wed May 24, 2006 7:32 am
by narcis
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.
Re: Changing axis labels
Posted: Tue Jan 29, 2008 9:19 pm
by 9047589
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.