Page 1 of 1

Marks just for individual points along a series

Posted: Fri Dec 02, 2011 8:26 am
by 16458388
Hello,
I tried to use the marks-feature to label just one or a few points of the complete series (TPointSeries or TLineSeries). The other points should be left unlabeled. However, my experiments with the series.marks object did not seem to be very successful. I tried the following code (using TeeChart 2010):

Code: Select all

  Series:=TLineSeries(Chart1.SeriesList[0]);
  Series.Clear;
  Series.Pen.Visible:=true;
  Series.Pointer.Visible:=true;
  for i := 0 to 10 do
  begin
    Series.AddXY(i,random(10),'');
    if i=3 then
      Series.ValueMarkText[i]:='Special Point'
    else
      Series.ValueMarkText[i]:='';
  end;
  series.Marks.Visible:=true;
  Series.Marks.OnTop:=true;
As expected, the point of index 3 was labeled with "Special Point", but all other points were marked as well: their label contains the current y-value of the point, although I set ValueMarkText:='' (empty string). Has anybody any idea how to solve this problem? Im sure, there is a very simple solution for this, but I couldn't find the answer from online help or forum posts.

Re: Marks just for individual points along a series

Posted: Fri Dec 02, 2011 9:12 am
by 10553945
Have you tried the OnGetMarkText event of a series?
Something like:

Code: Select all

procedure TMainForm.Series1GetMarkText(Sender: TChartSeries;
  ValueIndex: Integer; var MarkText: string);
begin
  if ValueIndex=3 then
    MarkText := 'Hello'
  else
    MarkText := '';
end;
Regards, Uli

Re: Marks just for individual points along a series

Posted: Fri Dec 02, 2011 10:00 am
by 16458388
Thanks a lot!
this is exactly, what I've been looking for and it works fine!

Best Regards,
Andreas