Page 1 of 1

TChartSeries.OnGetMarkText and TMarksTipTool.OnGetText

Posted: Wed May 09, 2007 5:20 pm
by 9234349
Hi,

I want to have different mark text displayed when the mark is initiated by the TMarkTipTool, or when it is initiated as the chart is drawn by the normal TChartSeries.OnGetMarkText.

I can't figure out how to do this because it seems that the TMarkToolTip is getting the mark text by calling TChartSeries.OnGetMarkText. I think I need something passed to TChartSeries.OnGetMarkText that tells me who is requesting the mark text.

Regards,

Bill

Posted: Thu May 10, 2007 10:22 am
by narcis
Hi Bill,

You can use both events as shown here:

Code: Select all

var
  Form1: TForm1;
  Series: TChartSeries;
  Index: Integer;

implementation

{$R *.dfm}

procedure TForm1.Series1GetMarkText(Sender: TChartSeries;
  ValueIndex: Integer; var MarkText: String);
begin
  MarkText := 'Point ' + IntToStr(ValueIndex+1);
  Series:=Sender;
  Index:=ValueIndex;
end;

procedure TForm1.ChartTool1GetText(Sender: TMarksTipTool;
  var Text: String);
begin
  Text := FloatToStr(Series.YValue[Index]);
end;

Posted: Thu May 10, 2007 10:45 am
by 9234349
Thank you. That works.

Bill