Page 1 of 1

Suggestion: TAG property to TChartAxis

Posted: Thu Jul 21, 2011 11:46 am
by 16558106
Hello,

since I always have the same problem connecting any information to a TChartAxis I want to suggest adding a published TAG or DATA (Integer) property to the TChartAxis Class.

With this tag I could add my own objects to the axis. A great help whenever you want to find the corresponding axis to connect grouped series.

Example how you could use this tag for detecting the correct axis to connect a series to:

If TMyObject(mychart.customaxes.tag).PhysUnit = Searchunit then
MyLineSeries.customvertaxis:=mychart.customaxes;

My be you could take this idea into account for the future?

thanks
Jo

Re: Suggestion: TAG property to TChartAxis

Posted: Fri Jul 22, 2011 2:26 pm
by yeray
Hello Jo,

I've added it to the wish list to be investigated for inclusion in future releases (TV52015673).
In the meanwhile, I think you shouldn't find too much problems on inheriting from TChartAxis and add the "Tag" property yourself. For example:

Code: Select all

uses Series;

type MyAxis=class(TChartAxis)
  private
    Tag: Integer;
  public
    Constructor Create(Collection:TCollection); override;
end;

{ MyAxis }
constructor MyAxis.Create(Collection: TCollection);
begin
  inherited;
  Tag:=-1;
end;

procedure TForm1.FormCreate(Sender: TObject);
var axis1: MyAxis;
begin
  Chart1.MarginLeft:=10;
  Chart1.View3D:=false;
  Chart1.AddSeries(TFastLineSeries).FillSampleValues();

  axis1:=MyAxis.Create(Chart1);
  Chart1[0].CustomVertAxis:=axis1;
  axis1.Tag:=5;

  axis1.Title.Caption:='my custom axis with tag=' + IntToStr(axis1.Tag);
  axis1.Title.Angle:=90;
end;

Re: Suggestion: TAG property to TChartAxis

Posted: Fri Jul 22, 2011 2:41 pm
by 16558106
Right. That's the way I did it in the past. Thank you!

Jays