Proposed patch for TCHartSeries.AssignFormat bug

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
h.hasenack
Newbie
Newbie
Posts: 32
Joined: Tue Jul 21, 2009 12:00 am
Location: Nijmegen, Netherlands

Proposed patch for TCHartSeries.AssignFormat bug

Post by h.hasenack » Fri Jul 24, 2009 11:30 am

In the Assignformat routine, some properties are linked rather than assigned :shock: . This causes unexpected results when charts are destroyed, of series are changed because of unexpected links between series and charts.

I make extensive use of chart formats and format assignment in my app, and this is a nasty bug causing trouble when "cloning" a chart for e.g. reporting purposes with quickreports or reportbuilder :!:

Code: Select all

procedure TChartSeries.AssignFormat(Source:TChartSeries);
var t : Integer;
begin
  With TChartSeries(Source) do
  begin
    <snip>
    Self.FPercentFormat  := FPercentFormat;
{$ifdef HH_PATCH_TC_ASSIGN}
// use assignment through properties so series will be linked onto correct axis
    Self.CustomHorizAxis:= CustomHorizAxis; // 6.01
    Self.HorizAxis      := HorizAxis;
    Self.CustomVertAxis := CustomVertAxis; // 6.01
    Self.VertAxis       := VertAxis;
{$else}
    Self.FCustomHorizAxis:= FCustomHorizAxis; // 6.01
    Self.FHorizAxis      := FHorizAxis;
    Self.FCustomVertAxis := FCustomVertAxis; // 6.01
    Self.FVertAxis       := FVertAxis;
{$endif}    
    Self.FRecalcOptions  := FRecalcOptions;
<snip>
  end;
end;
Regards - Hans

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

Re: Proposed patch for TCHartSeries.AssignFormat bug

Post by Yeray » Fri Jul 24, 2009 3:03 pm

Hi Hans,

Could you also send us a simple example project we can run as-is to reproduce this problem here?

Thanks in advance.
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

h.hasenack
Newbie
Newbie
Posts: 32
Joined: Tue Jul 21, 2009 12:00 am
Location: Nijmegen, Netherlands

Re: Proposed patch for TCHartSeries.AssignFormat bug

Post by h.hasenack » Mon Jul 27, 2009 7:36 am

Hi Yeray

The "bugfix" was a remainder of a patch I had to apply with Tee4 or Tee5, and it seems to me -after some testing- me it is no longer neccessary, probably because of the call to

Self.RecalcGetAxis; { 5.01 }

some lines further on.

:roll: But I still wonder how it can be right that the series of one chart get linked to the axis of a different chart..? (I use the Assignformat to 'clone' series between series of different charts, not series within the same chart)

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

Re: Proposed patch for TCHartSeries.AssignFormat bug

Post by Narcís » Mon Jul 27, 2009 3:06 pm

Hi Hans,

Thank you very much for your collaboration!
But I still wonder how it can be right that the series of one chart get linked to the axis of a different chart..?
Yes, it seems strange but IIRC some clients used that as a way of synchronizing charts or series scales using other chart's axes as custom axes.
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