Page 1 of 1

Series Marks

Posted: Fri Dec 12, 2008 1:47 pm
by 9337074
I am using TeeChart 7 with Delphi 2006. I want the series marks to display the yvalue when the user hovers over the mark. I think I should use the OnGetSeriesMark event but I don't know how to call it or create it. Can someone provide some guidance?

Posted: Fri Dec 12, 2008 2:26 pm
by narcis
Hi McMClark,

In that case it will be easier, you just need to set marks style like this:

Code: Select all

  Series1.Marks.Style:=smsValue;
You'll also find several mark text event examples searchin on the forums for OnGetMarkText.

Hope this helps!

Posted: Sat Dec 13, 2008 2:07 pm
by 9337074
Thanks for your reply.

I am still have a difficulty getting the YValue to appear when I hover over the mark (I still get the XValue). I use the following code:

tmpDefaultSeries := frmDefaultResultGraphAndDocuments.GetDefaultSeries(intDefaultAggChartSeries, tmpAggSeries);
DBChart1.AddSeries(tmpDefaultSeries);
DBChart1.Legend.Visible := True;
DBChart1.Legend.CheckBoxes := True;
intList2 := ds1.RecordCount;
with tmpDefaultSeries do
begin
DataSource := ds1;
YValues.ValueSource := 'Aggregates';
XLabelsSource := 'PublicationDate';
XValues.ValueSource := 'PublicationDate';
try
XValues.DateTime := True;
except
end;
Title := strSubModel + ' ' + strSeriesName;
tmpDefaultSeries.ColorEachPoint := False;
tmpDefaultSeries.Marks.Style := smsValue;
DBChart1.Draw;
end;

Can you tell me what I am doing wrong?

Posted: Mon Dec 15, 2008 9:22 am
by narcis
Hi McMClark,

Code below works fine for me here:

Code: Select all

procedure TForm1.FormCreate(Sender: TObject);
var i: Integer;
begin
  for i:=0 to 10 do
    Series1.AddXY(i, random, 'point ' + IntToStr(i));

  Series1.Marks.Visible:=true;
  Series1.Marks.Style:=smsValue;
end;
If the problem persists could you please send us a simple example project we can run "as-is" to reproduce the problem here? You can either post your files at news://www.steema.net/steema.public.attachments newsgroup or at our upload page.

Alternatively you can use OnGetMarkText event like this:

Code: Select all

procedure TForm1.FormCreate(Sender: TObject);
var i: Integer;
begin
  for i:=0 to 10 do
    Series1.AddXY(i, random, 'point ' + IntToStr(i));

  Series1.Marks.Visible:=true;
  //Series1.Marks.Style:=smsValue;
end;

procedure TForm1.Series1GetMarkText(Sender: TChartSeries;
  ValueIndex: Integer; var MarkText: String);
begin
  MarkText:=FloatToStr(Series1.YValue[ValueIndex]);
end;
Thanks in advance.

Posted: Mon Dec 15, 2008 2:36 pm
by 9337074
Thanks