Page 1 of 1

Proposed patch for TCHartSeries.AssignFormat bug

Posted: Fri Jul 24, 2009 11:30 am
by 10553957
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

Re: Proposed patch for TCHartSeries.AssignFormat bug

Posted: Fri Jul 24, 2009 3:03 pm
by yeray
Hi Hans,

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

Thanks in advance.

Re: Proposed patch for TCHartSeries.AssignFormat bug

Posted: Mon Jul 27, 2009 7:36 am
by 10553957
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)

Re: Proposed patch for TCHartSeries.AssignFormat bug

Posted: Mon Jul 27, 2009 3:06 pm
by narcis
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.