Marks just for individual points along a series

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
Andreas iCD
Newbie
Newbie
Posts: 12
Joined: Mon Jan 17, 2011 12:00 am

Marks just for individual points along a series

Post by Andreas iCD » Fri Dec 02, 2011 8:26 am

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.

ulibru
Newbie
Newbie
Posts: 53
Joined: Tue Jul 21, 2009 12:00 am

Re: Marks just for individual points along a series

Post by ulibru » Fri Dec 02, 2011 9:12 am

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

Andreas iCD
Newbie
Newbie
Posts: 12
Joined: Mon Jan 17, 2011 12:00 am

Re: Marks just for individual points along a series

Post by Andreas iCD » Fri Dec 02, 2011 10:00 am

Thanks a lot!
this is exactly, what I've been looking for and it works fine!

Best Regards,
Andreas

Post Reply