Mark Text not persisted when assign to another chart

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
SteveP
Advanced
Posts: 132
Joined: Sun Sep 07, 2003 4:00 am

Mark Text not persisted when assign to another chart

Post by SteveP » Wed Mar 02, 2005 7:29 pm

I'm assigning a chart to another temporary invisible chart for printing from. I've changed the main chart's mark's text in OnGetMarkText. The original, not the changed text, is what is printed from the second chart.

Is there a way to access the actual mark's text and assign that to the new chart ? Perhaps expose the second chart's series OnGetMarkText event and change it there or access the second chart's mark's DrawText method ? Or create the second chart then change its mark text from the main chart's series OnGetMarkText event ?

Steve

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

Post by Narcís » Thu Mar 03, 2005 12:00 pm

Hi Steve,

You have to do it "manually". One easy way to do this is assigning the cloned series OnGetMarkText event to the original series event like shown below.

Code: Select all

procedure TForm1.FormCreate(Sender: TObject);
var
  i: integer;
begin
  Series1.FillSampleValues();

  InvChart.FreeAllSeries;
  InvChart.Assign(Chart1);
  for i:=0 to Chart1.SeriesCount-1 do
    begin
      CloneChartSeries(Chart1[i]).ParentChart:=InvChart;
      InvChart[i].OnGetMarkText:=Chart1[i].OnGetMarkText;
    end;
end;

procedure TForm1.Series1GetMarkText(Sender: TChartSeries;
  ValueIndex: Integer; var MarkText: String);
begin
  MarkText:='Mark '+IntToStr(ValueIndex);
end;
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

Post Reply