Page 1 of 1

Mark tips Style

Posted: Wed Jun 18, 2008 8:15 am
by 10045570
Is there a way to display in mark tips Series name and X.Y values??????
Thanks
Alex

Posted: Wed Jun 18, 2008 9:32 am
by yeray
Hi Alex,

Yes, with OnGetMarkText event, from your series, you can customize its mark text as you want:

Code: Select all

procedure TForm1.FormCreate(Sender: TObject);
begin
  Series1.Marks.Visible := True;
end;

procedure TForm1.Series1GetMarkText(Sender: TChartSeries;
  ValueIndex: Integer; var MarkText: String);
begin
    MarkText := Sender.Name + '   X: ' + floattostr(Sender.XValues.Items[ValueIndex]) +
              '   Y: ' + floattostr(Sender.YValues.Items[ValueIndex]);
end;

Posted: Wed Jun 18, 2008 10:18 am
by 10045570
If i undestand well you mean you can customize the text of the marks on the chart.....
I want to use the MArk Tips Tools and display Name , X,Y value....
Is it possible

Posted: Wed Jun 18, 2008 10:23 am
by narcis
Hi IQSoft,

Yes, the MarkTips tool display marks text even if it's customized.

Posted: Wed Jun 18, 2008 11:16 am
by 10045570
it can be customized the same way?????
Alex

Posted: Wed Jun 18, 2008 11:17 am
by 10045570
I can be customized by code or by the user ( editing the diagram???)

Posted: Wed Jun 18, 2008 11:36 am
by narcis
Hi Alex,

It can be customized programmatically using the OnGetText event.

Posted: Thu Jun 19, 2008 11:45 am
by 10045570
Can i have a small sample of customizing text?????
Thanks
Alex

Posted: Thu Jun 19, 2008 12:02 pm
by narcis
Hi Alex,

You just need to add a TMarksTipTool to your application and make series marks not visible. The code Yeray posted will modify tool's text as well, for example:

Code: Select all

procedure TForm1.FormCreate(Sender: TObject);
begin
  Series1.Marks.Visible := False;
end;

procedure TForm1.Series1GetMarkText(Sender: TChartSeries;
  ValueIndex: Integer; var MarkText: String);
begin
  MarkText := Sender.Name + ' X: ' + FloatToStr(Sender.XValues.Items[ValueIndex]) +
              ' Y: ' + FloatToStr(Sender.YValues.Items[ValueIndex]);
end;