Page 1 of 1

lael for a series

Posted: Fri Sep 02, 2005 3:36 pm
by 9231397
I have a chart which draws multiple tlineseries, I would like to put a label on the chart against each lineseries, drawn next to either the first or last x,y point of the lineseries. Can someone point me in the right direction to do this please.

thanks
Sean

Posted: Fri Sep 02, 2005 4:17 pm
by narcis
Hi Sean,

You have several options for doing that:

1) Using custom labels. You can make both vertical axes visible using one for your custom labels and the other one for the series values labels:

Code: Select all

procedure TForm1.FormCreate(Sender: TObject);
var
  i: Integer;
begin
  for i:=0 to Chart1.SeriesCount-1 do
    With Chart1[i] do
    begin
      FillSampleValues();
      VertAxis:=aBothVertAxis;
      Chart1.Axes.Right.Items.Add(YValue[Count-1],'Series'+IntToStr(i));
    end;
  Chart1.Axes.Right.Grid.Visible:=false;
end;
For more information on custom labels please have a look at the TeeChart features demo, available at the TeeChart program group, and search for custom labels.

2) Using annotation tools. For more information on how to use them please have a look at All Features\Welcome!\Tools\Annotation example at the TeeChart features demo.

3) Custom drawing on TChart's canvas. For more information on how to custom draw on TChart please have a look at the TeeChart tutorials at the "Documentation" folder at the TeeChart program group.

Posted: Sat Sep 03, 2005 9:26 am
by 9231397
thanks Narcis,

I can get some of that to work with annotation tools, but am now struggling with creating an annotation tools in code, could you help me with this please....


mytool:array[1..20] of TAnnotationTool;

for i:=1 to X do
begin
mytool:=TAnnotationTool.Create(self);
chart.Add ???(mytool) <<<
end;


its the chart.add??? line I can't find a method for, I use similar to create series and add to a chart at run time, but need something to do the same job for the annotation tool.

thanks,
Sean

Posted: Mon Sep 05, 2005 7:18 am
by narcis
Hi Sean,

Yes, you need to use ParentChart property:

Code: Select all

  for i:=1 to X do
  begin
    mytool[i]:=TAnnotationTool.Create(self);
    mytool[i].ParentChart:=Chart1;
  end;