Series Marks

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
McMClark
Newbie
Newbie
Posts: 50
Joined: Thu Apr 15, 2004 4:00 am

Series Marks

Post by McMClark » Fri Dec 12, 2008 1:47 pm

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?

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Fri Dec 12, 2008 2:26 pm

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!
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

McMClark
Newbie
Newbie
Posts: 50
Joined: Thu Apr 15, 2004 4:00 am

Post by McMClark » Sat Dec 13, 2008 2:07 pm

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?

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Mon Dec 15, 2008 9:22 am

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.
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

McMClark
Newbie
Newbie
Posts: 50
Joined: Thu Apr 15, 2004 4:00 am

Post by McMClark » Mon Dec 15, 2008 2:36 pm

Thanks

Post Reply