Save Marks text

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
GE-BB-CB
Newbie
Newbie
Posts: 4
Joined: Fri Feb 13, 2015 12:00 am

Save Marks text

Post by GE-BB-CB » Wed May 13, 2015 9:58 am

Hello,

I use TChart and TSeries for some acquisition of data during a time.

I want to draw marks on some points I have on my series which match with a certain time.

I use the event TSeriesGetMarkText to make visible (MarkText:='Text') or not (MarkText:='') the marks depending on the time.

It works well but at the end, I save my chart in a stream file. When I open this file in an other chart, all marks are visible and the labels match with the YValues of the points.

How can I save the text and the index of the marks I put in the event TSeriesGetMarkText and open it in the right way in an other chart ?

Thanks in advance.

Benoît

Yeray
Site Admin
Site Admin
Posts: 9514
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

Re: Save Marks text

Post by Yeray » Thu May 14, 2015 7:53 am

Hello Benoît,

I'm afraid the exportation can store the design of the chart but not the code in the application.
Instead of using the TSeriesGetMarkText, you could populate the series' Labels array and the empty strings won't be shown. Here you have a simple example:

Code: Select all

uses Series, DateUtils;

procedure TForm1.FormCreate(Sender: TObject);
var i: Integer;
    tmpDate: TDateTime;
    str: string;
begin
  Chart1.Legend.Visible:=false;

  with Chart1.AddSeries(TPointSeries) as TPointSeries do
  begin
    XValues.DateTime:=true;

    for i:=0 to 9 do
    begin
      str:='';
      tmpDate:=Today+i;

      if (i mod 4 = 0) then
        str:='point ' + IntToStr(i);

      AddXY(tmpDate, 25+random*75, str);
    end;

    Marks.Visible:=true;
    Marks.Style:=smsLabel;
  end;

  Chart1.Axes.Bottom.LabelStyle:=talValue;
end;
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

GE-BB-CB
Newbie
Newbie
Posts: 4
Joined: Fri Feb 13, 2015 12:00 am

Re: Save Marks text

Post by GE-BB-CB » Mon May 18, 2015 2:58 pm

Hello Yeray,

Thanks for your solution, it seems to work well !

Benoît

Post Reply