View Issue Details

IDProjectCategoryView StatusLast Update
0035388LazarusTAChartpublic2019-04-30 03:59
ReporterMarcin WiazowskiAssigned Towp 
PrioritynormalSeverityminorReproducibilityalways
Status closedResolutionfixed 
Product Version2.1 (SVN)Product Build60989 
Target Version2.2Fixed in Version 
Summary0035388: TAChart: patch to reflect original data source properly
DescriptionI'm attaching a patch for TCalculatedChartSource and TCustomAnimatedChartSource, that allows them to reflect properties of their origins properly.


TCalculatedChartSource:

1) Added fix for resetting FYXount in Changed() properly

2) Data sources using the origin should have their FXCount and FYCount set to 0, when origin is not assigned. And this is implemented, with one omission: initially there is no origin attached, so FXCount and FYCount should be initialized to 0 in the constructor (since they are set to 1 in the inherited constructor).


TCustomAnimatedChartSource:

3) In Changed(), code for reflecting the origin properly was added - which is similar to 1)

4) As in 2)

5) Changing the origin should update the reflected origin state - so lacking call to Changed() was added in SetOrigin()
TagsNo tags attached.
Fixed in Revisionr61020, r61022, 61079
LazTarget2.2
WidgetsetWin32/Win64
Attached Files
  • patch.diff (2,519 bytes)
    Index: components/tachart/taanimatedsource.pas
    ===================================================================
    --- components/tachart/taanimatedsource.pas	(revision 60988)
    +++ components/tachart/taanimatedsource.pas	(working copy)
    @@ -83,10 +83,30 @@
     uses
       LCLIntf, Math, SysUtils;
     
    +type
    +  TCustomChartSourceAccess = class(TCustomChartSource);
    +
     { TCustomAnimatedChartSource }
     
     procedure TCustomAnimatedChartSource.Changed(ASender: TObject);
     begin
    +  if FOrigin <> nil then begin
    +    FSortBy := TCustomChartSourceAccess(Origin).SortBy;
    +    FSortDir := TCustomChartSourceAccess(Origin).SortDir;
    +    FSortIndex := TCustomChartSourceAccess(Origin).SortIndex;
    +    // The user may modify data items in any way, so we can't guarantee,
    +    // that modified data is still sorted in any way; for this reason,
    +    // TCustomAnimatedChartSource.IsSorted() always returns False
    +    FXCount := Origin.XCount;
    +    FYCount := Origin.YCount;
    +  end else begin
    +    FSortBy := sbX;
    +    FSortDir := sdAscending;
    +    FSortIndex := 0;
    +    FXCount := 0;
    +    FYCount := 0;
    +  end;
    +
       Unused(ASender);
       Notify;
     end;
    @@ -94,6 +114,8 @@
     constructor TCustomAnimatedChartSource.Create(AOwner: TComponent);
     begin
       inherited Create(AOwner);
    +  FXCount := 0;
    +  FYCount := 0;
       FListener := TListener.Create(@FOrigin, @Changed);
       FTimer := TCustomTimer.Create(nil);
       FTimer.Enabled := false;
    @@ -187,6 +209,7 @@
       FOrigin := AValue;
       if FOrigin <> nil then
         FOrigin.Broadcaster.Subscribe(FListener);
    +  Changed(nil);
     end;
     
     procedure TCustomAnimatedChartSource.SetXCount(AValue: Cardinal);
    Index: components/tachart/tasources.pas
    ===================================================================
    --- components/tachart/tasources.pas	(revision 60988)
    +++ components/tachart/tasources.pas	(working copy)
    @@ -1494,6 +1494,7 @@
         // data is still sorted by Y or by Origin's custom algorithm
         FSorted := (FSortBy in [sbX, sbColor, sbText]) and Origin.IsSorted;
         FXCount := Origin.XCount;
    +    // FYCount is set below, in the UpdateYOrder() call
       end else begin
         FSortBy := sbX;
         FSortDir := sdAscending;
    @@ -1500,6 +1501,7 @@
         FSortIndex := 0;
         FSorted := false;
         FXCount := 0;
    +    FYCount := 0;
       end;
     
       if
    @@ -1517,6 +1519,8 @@
     constructor TCalculatedChartSource.Create(AOwner: TComponent);
     begin
       inherited Create(AOwner);
    +  FXCount := 0;
    +  FYCount := 0;
       FAccumulationRange := 2;
       FIndex := -1;
       FHistory := TChartSourceBuffer.Create;
    
    patch.diff (2,519 bytes)
  • Reproduce.zip (2,494 bytes)
  • update.diff (2,403 bytes)
    Index: components/tachart/taanimatedsource.pas
    ===================================================================
    --- components/tachart/taanimatedsource.pas	(revision 61066)
    +++ components/tachart/taanimatedsource.pas	(working copy)
    @@ -83,9 +83,6 @@
     uses
       LCLIntf, Math, SysUtils;
     
    -type
    -  TCustomChartSourceAccess = class(TCustomChartSource);
    -
     { TCustomAnimatedChartSource }
     
     procedure TCustomAnimatedChartSource.Changed(ASender: TObject);
    @@ -95,7 +92,7 @@
         FXCount := Origin.XCount;
         FYCount := Origin.YCount;
       end else begin
    -    FXCount := MaxInt;
    +    FXCount := MaxInt;    // Allow source to be used by any series while Origin = nil
         FYCount := MaxInt;
       end;
       Notify;
    @@ -104,7 +101,7 @@
     constructor TCustomAnimatedChartSource.Create(AOwner: TComponent);
     begin
       inherited Create(AOwner);
    -  FXCount := MaxInt;
    +  FXCount := MaxInt;    // Allow source to be used by any series while Origin = nil
       FYCount := MaxInt;
       FListener := TListener.Create(@FOrigin, @Changed);
       FTimer := TCustomTimer.Create(nil);
    Index: components/tachart/taradialseries.pas
    ===================================================================
    --- components/tachart/taradialseries.pas	(revision 61066)
    +++ components/tachart/taradialseries.pas	(working copy)
    @@ -1263,6 +1263,7 @@
     var
       j: Integer;
     begin
    +  if Source.Count = 0 then exit;
       originPt := ParentChart.GraphToImage(DoublePoint(OriginX, OriginY));
       fill := FFilled and (FBrush.Style <> bsClear);
       SetLength(pts, Count + 1);  // +1 for origin
    Index: components/tachart/taseries.pas
    ===================================================================
    --- components/tachart/taseries.pas	(revision 61066)
    +++ components/tachart/taseries.pas	(working copy)
    @@ -469,6 +469,7 @@
       ext: TDoubleRect;
       i: Integer;
     begin
    +  if Source.Count = 0 then exit;
       with Extent do begin
         ext.a := AxisToGraph(a);
         ext.b := AxisToGraph(b);
    Index: components/tachart/tasources.pas
    ===================================================================
    --- components/tachart/tasources.pas	(revision 61066)
    +++ components/tachart/tasources.pas	(working copy)
    @@ -1500,7 +1500,7 @@
         FSortDir := sdAscending;
         FSortIndex := 0;
         FSorted := false;
    -    FXCount := MaxInt;
    +    FXCount := MaxInt;    // Allow source to be used by any series while Origin = nil
         FYCount := MaxInt;
       end;
     
    
    update.diff (2,403 bytes)
  • Reproduce2.zip (2,256 bytes)
  • update_ver2.diff (3,650 bytes)
    Index: components/tachart/taanimatedsource.pas
    ===================================================================
    --- components/tachart/taanimatedsource.pas	(revision 61069)
    +++ components/tachart/taanimatedsource.pas	(working copy)
    @@ -83,9 +83,6 @@
     uses
       LCLIntf, Math, SysUtils;
     
    -type
    -  TCustomChartSourceAccess = class(TCustomChartSource);
    -
     { TCustomAnimatedChartSource }
     
     procedure TCustomAnimatedChartSource.Changed(ASender: TObject);
    @@ -95,7 +92,7 @@
         FXCount := Origin.XCount;
         FYCount := Origin.YCount;
       end else begin
    -    FXCount := MaxInt;
    +    FXCount := MaxInt;    // Allow source to be used by any series while Origin = nil
         FYCount := MaxInt;
       end;
       Notify;
    @@ -104,7 +101,7 @@
     constructor TCustomAnimatedChartSource.Create(AOwner: TComponent);
     begin
       inherited Create(AOwner);
    -  FXCount := MaxInt;
    +  FXCount := MaxInt;    // Allow source to be used by any series while Origin = nil
       FYCount := MaxInt;
       FListener := TListener.Create(@FOrigin, @Changed);
       FTimer := TCustomTimer.Create(nil);
    Index: components/tachart/taradialseries.pas
    ===================================================================
    --- components/tachart/taradialseries.pas	(revision 61069)
    +++ components/tachart/taradialseries.pas	(working copy)
    @@ -1263,6 +1263,7 @@
     var
       j: Integer;
     begin
    +  if IsEmpty then exit;
       originPt := ParentChart.GraphToImage(DoublePoint(OriginX, OriginY));
       fill := FFilled and (FBrush.Style <> bsClear);
       SetLength(pts, Count + 1);  // +1 for origin
    Index: components/tachart/taseries.pas
    ===================================================================
    --- components/tachart/taseries.pas	(revision 61069)
    +++ components/tachart/taseries.pas	(working copy)
    @@ -469,6 +469,7 @@
       ext: TDoubleRect;
       i: Integer;
     begin
    +  if IsEmpty then exit;
       with Extent do begin
         ext.a := AxisToGraph(a);
         ext.b := AxisToGraph(b);
    Index: components/tachart/tasources.pas
    ===================================================================
    --- components/tachart/tasources.pas	(revision 61069)
    +++ components/tachart/tasources.pas	(working copy)
    @@ -1500,7 +1500,7 @@
         FSortDir := sdAscending;
         FSortIndex := 0;
         FSorted := false;
    -    FXCount := MaxInt;
    +    FXCount := MaxInt;    // Allow source to be used by any series while Origin = nil
         FYCount := MaxInt;
       end;
     
    @@ -1548,7 +1548,7 @@
     
       function YByOrder(AOrderIndex: Integer): Double;
       begin
    -    if AOrderIndex = 0 then
    +    if AOrderIndex <= 0 then
           Result := FItem.Y
         else
           Result := FItem.YList[AOrderIndex - 1];
    @@ -1559,11 +1559,14 @@
       i: Integer;
     begin
       FItem := Origin[AIndex]^;
    -  SetLength(t, High(FYOrder));
    -  for i := 1 to High(FYOrder) do
    -    t[i - 1] := YByOrder(FYOrder[i]);
    -  FItem.Y := YByOrder(FYOrder[0]);
    -  FItem.YList := t;
    +  if Length(FYOrder) > 0 then begin
    +    SetLength(t, High(FYOrder));
    +    for i := 1 to High(FYOrder) do
    +      t[i - 1] := YByOrder(FYOrder[i]);
    +    FItem.Y := YByOrder(FYOrder[0]);
    +    FItem.YList := t;
    +  end else
    +    FItem.YList := nil;
     end;
     
     function TCalculatedChartSource.GetCount: Integer;
    @@ -1678,7 +1681,7 @@
     begin
       if FOrigin = nil then begin
         FOriginYCount := 0;
    -    FYCount := 0;
    +    FYCount := MaxInt;    // Allow source to be used by any series while Origin = nil
         FYOrder := nil;
         FItem.YList := nil;
         Changed(nil);
    @@ -1686,6 +1689,9 @@
       end;
     
       FOriginYCount := FOrigin.YCount;
    +  if FOriginYCount = 0 then
    +    FYOrder := nil
    +  else
       if ReorderYList = '' then begin
         SetLength(FYOrder, FOriginYCount);
         for i := 0 to High(FYOrder) do
    
    update_ver2.diff (3,650 bytes)

Activities

Marcin Wiazowski

2019-04-16 02:38

reporter  

patch.diff (2,519 bytes)
Index: components/tachart/taanimatedsource.pas
===================================================================
--- components/tachart/taanimatedsource.pas	(revision 60988)
+++ components/tachart/taanimatedsource.pas	(working copy)
@@ -83,10 +83,30 @@
 uses
   LCLIntf, Math, SysUtils;
 
+type
+  TCustomChartSourceAccess = class(TCustomChartSource);
+
 { TCustomAnimatedChartSource }
 
 procedure TCustomAnimatedChartSource.Changed(ASender: TObject);
 begin
+  if FOrigin <> nil then begin
+    FSortBy := TCustomChartSourceAccess(Origin).SortBy;
+    FSortDir := TCustomChartSourceAccess(Origin).SortDir;
+    FSortIndex := TCustomChartSourceAccess(Origin).SortIndex;
+    // The user may modify data items in any way, so we can't guarantee,
+    // that modified data is still sorted in any way; for this reason,
+    // TCustomAnimatedChartSource.IsSorted() always returns False
+    FXCount := Origin.XCount;
+    FYCount := Origin.YCount;
+  end else begin
+    FSortBy := sbX;
+    FSortDir := sdAscending;
+    FSortIndex := 0;
+    FXCount := 0;
+    FYCount := 0;
+  end;
+
   Unused(ASender);
   Notify;
 end;
@@ -94,6 +114,8 @@
 constructor TCustomAnimatedChartSource.Create(AOwner: TComponent);
 begin
   inherited Create(AOwner);
+  FXCount := 0;
+  FYCount := 0;
   FListener := TListener.Create(@FOrigin, @Changed);
   FTimer := TCustomTimer.Create(nil);
   FTimer.Enabled := false;
@@ -187,6 +209,7 @@
   FOrigin := AValue;
   if FOrigin <> nil then
     FOrigin.Broadcaster.Subscribe(FListener);
+  Changed(nil);
 end;
 
 procedure TCustomAnimatedChartSource.SetXCount(AValue: Cardinal);
Index: components/tachart/tasources.pas
===================================================================
--- components/tachart/tasources.pas	(revision 60988)
+++ components/tachart/tasources.pas	(working copy)
@@ -1494,6 +1494,7 @@
     // data is still sorted by Y or by Origin's custom algorithm
     FSorted := (FSortBy in [sbX, sbColor, sbText]) and Origin.IsSorted;
     FXCount := Origin.XCount;
+    // FYCount is set below, in the UpdateYOrder() call
   end else begin
     FSortBy := sbX;
     FSortDir := sdAscending;
@@ -1500,6 +1501,7 @@
     FSortIndex := 0;
     FSorted := false;
     FXCount := 0;
+    FYCount := 0;
   end;
 
   if
@@ -1517,6 +1519,8 @@
 constructor TCalculatedChartSource.Create(AOwner: TComponent);
 begin
   inherited Create(AOwner);
+  FXCount := 0;
+  FYCount := 0;
   FAccumulationRange := 2;
   FIndex := -1;
   FHistory := TChartSourceBuffer.Create;
patch.diff (2,519 bytes)

wp

2019-04-18 22:38

developer   ~0115664

> Data sources using the origin should have their FXCount and FYCount set to 0,
> when origin is not assigned.

What would be the effect of FXCount and FYCount > 0 here (beyond good programming style)? These sources are not usable anyway when their "Origin" is unassigned.

And BTW, why reset to 0? 0 has a special meaning now, at least for FXCount. Wouldn't -1 be a better choice to indicate the state "currently not in used"?

Marcin Wiazowski

2019-04-19 04:33

reporter   ~0115666

> What would be the effect of FXCount and FYCount > 0 here (beyond good programming style)? These sources are not usable anyway when their "Origin" is unassigned.

Curently, i.e. with FXCount = FYCount = 1, these sources are also not fully usable, when their "Origin" is unassigned - they cannot be assigned to TFieldSeries, which requires FXCount = FYCount = 2.



> And BTW, why reset to 0? 0 has a special meaning now, at least for FXCount.

I just followed the already implemented convention - TCalculatedChartSource.UpdateYOrder() sets FYCount to 0 when origin is nil; so - logically - also after creation of TCalculatedChartSource - when origin is not assigned - FXCount and FYCount should be 0.

What's more, currently - after assigning the origin and then unassigning it - FYCount is set to 0, so source becomes not usable...

So we have just a bit of mess...



> Wouldn't -1 be a better choice to indicate the state "currently not in used"?

They are Cardnals - and must stay cardinals, see 0035089: "Changed all XCount and YCount occurances to Integer - and noticed that it breaks compilation of the visual fpspreadsheet components. Maybe there are other third-party chart sources out there."



I tried to set them to $FFFFFFFF, but - as far as I remember - this caused memory allocation error in bar series immediately.



Maybe these sources should be initialized / reset to some FXCount / FYCount values like 16 ***at design time*** ? Some constant could be added to implement this value.

wp

2019-04-19 14:03

developer   ~0115672

In r61020, I set them to MaxInt in Create() and in Changed() so that the XCount/YCount exception of the attached source is avoided while Origin is nil. Shown to work with BarSeries and BubbleSeries. I cannot imagine an issue with memory allocation because a CalculatedChartSource with Origin=nil reports Count=0 and thus should be skipped by all TAChart methods.

wp

2019-04-19 17:43

developer   ~0115679

The same for TCustomAnimationSource in r61022. I did not propagate the sort settings because this source itself is not sorted. I think that TCalculatedChartSource should be treated in the same way.

Marcin Wiazowski

2019-04-27 23:16

reporter  

Reproduce.zip (2,494 bytes)
update.diff (2,403 bytes)
Index: components/tachart/taanimatedsource.pas
===================================================================
--- components/tachart/taanimatedsource.pas	(revision 61066)
+++ components/tachart/taanimatedsource.pas	(working copy)
@@ -83,9 +83,6 @@
 uses
   LCLIntf, Math, SysUtils;
 
-type
-  TCustomChartSourceAccess = class(TCustomChartSource);
-
 { TCustomAnimatedChartSource }
 
 procedure TCustomAnimatedChartSource.Changed(ASender: TObject);
@@ -95,7 +92,7 @@
     FXCount := Origin.XCount;
     FYCount := Origin.YCount;
   end else begin
-    FXCount := MaxInt;
+    FXCount := MaxInt;    // Allow source to be used by any series while Origin = nil
     FYCount := MaxInt;
   end;
   Notify;
@@ -104,7 +101,7 @@
 constructor TCustomAnimatedChartSource.Create(AOwner: TComponent);
 begin
   inherited Create(AOwner);
-  FXCount := MaxInt;
+  FXCount := MaxInt;    // Allow source to be used by any series while Origin = nil
   FYCount := MaxInt;
   FListener := TListener.Create(@FOrigin, @Changed);
   FTimer := TCustomTimer.Create(nil);
Index: components/tachart/taradialseries.pas
===================================================================
--- components/tachart/taradialseries.pas	(revision 61066)
+++ components/tachart/taradialseries.pas	(working copy)
@@ -1263,6 +1263,7 @@
 var
   j: Integer;
 begin
+  if Source.Count = 0 then exit;
   originPt := ParentChart.GraphToImage(DoublePoint(OriginX, OriginY));
   fill := FFilled and (FBrush.Style <> bsClear);
   SetLength(pts, Count + 1);  // +1 for origin
Index: components/tachart/taseries.pas
===================================================================
--- components/tachart/taseries.pas	(revision 61066)
+++ components/tachart/taseries.pas	(working copy)
@@ -469,6 +469,7 @@
   ext: TDoubleRect;
   i: Integer;
 begin
+  if Source.Count = 0 then exit;
   with Extent do begin
     ext.a := AxisToGraph(a);
     ext.b := AxisToGraph(b);
Index: components/tachart/tasources.pas
===================================================================
--- components/tachart/tasources.pas	(revision 61066)
+++ components/tachart/tasources.pas	(working copy)
@@ -1500,7 +1500,7 @@
     FSortDir := sdAscending;
     FSortIndex := 0;
     FSorted := false;
-    FXCount := MaxInt;
+    FXCount := MaxInt;    // Allow source to be used by any series while Origin = nil
     FYCount := MaxInt;
   end;
 
update.diff (2,403 bytes)

Marcin Wiazowski

2019-04-27 23:17

reporter   ~0115860

> I cannot imagine an issue with memory allocation because [...]

I was wrong - the problem is elsewhere. I tested all the existing series that use sources - and TLineSeries and TPolarSeries are problematic. This is because they perform loops from 0 to YCount-1 or YCount-2, even when Count is 0 - which effectively hangs the application (or IDE).

So I attached a test application and a patch for the problem (which also makes some cosmetic updates).



> TCustomAnimationSource [...] I did not propagate the sort settings because this source itself is not sorted.

Sure. This was my copy-paste mistake. TCustomAnimationSource is never sorted, so assigning sorting properties didn't make any sense.


> I think that TCalculatedChartSource should be treated in the same way.

TCalculatedChartSource can sometimes be sorted, so assigning sorting properties is required here.

Marcin Wiazowski

2019-04-28 03:49

reporter   ~0115865

One more issue: in TCalculatedChartSource.UpdateYOrder(), there is:

  if FOrigin = nil then begin
    FOriginYCount := 0;
    FYCount := 0; <==== SHOULD BE FYCount := MaxInt
    FYOrder := nil;
    FItem.YList := nil;
    Changed(nil);
    exit;
  end;

Marcin Wiazowski

2019-04-28 19:58

reporter   ~0115881

TCalculatedChartSource has still some problems with reflecting data source having YCount = 0 - see the attached Reproduce2 test application.

So I'm attaching update_ver2.diff (which fully includes update.diff) to fix these issues - and also the issue from my post above.

Reproduce2.zip (2,256 bytes)
update_ver2.diff (3,650 bytes)
Index: components/tachart/taanimatedsource.pas
===================================================================
--- components/tachart/taanimatedsource.pas	(revision 61069)
+++ components/tachart/taanimatedsource.pas	(working copy)
@@ -83,9 +83,6 @@
 uses
   LCLIntf, Math, SysUtils;
 
-type
-  TCustomChartSourceAccess = class(TCustomChartSource);
-
 { TCustomAnimatedChartSource }
 
 procedure TCustomAnimatedChartSource.Changed(ASender: TObject);
@@ -95,7 +92,7 @@
     FXCount := Origin.XCount;
     FYCount := Origin.YCount;
   end else begin
-    FXCount := MaxInt;
+    FXCount := MaxInt;    // Allow source to be used by any series while Origin = nil
     FYCount := MaxInt;
   end;
   Notify;
@@ -104,7 +101,7 @@
 constructor TCustomAnimatedChartSource.Create(AOwner: TComponent);
 begin
   inherited Create(AOwner);
-  FXCount := MaxInt;
+  FXCount := MaxInt;    // Allow source to be used by any series while Origin = nil
   FYCount := MaxInt;
   FListener := TListener.Create(@FOrigin, @Changed);
   FTimer := TCustomTimer.Create(nil);
Index: components/tachart/taradialseries.pas
===================================================================
--- components/tachart/taradialseries.pas	(revision 61069)
+++ components/tachart/taradialseries.pas	(working copy)
@@ -1263,6 +1263,7 @@
 var
   j: Integer;
 begin
+  if IsEmpty then exit;
   originPt := ParentChart.GraphToImage(DoublePoint(OriginX, OriginY));
   fill := FFilled and (FBrush.Style <> bsClear);
   SetLength(pts, Count + 1);  // +1 for origin
Index: components/tachart/taseries.pas
===================================================================
--- components/tachart/taseries.pas	(revision 61069)
+++ components/tachart/taseries.pas	(working copy)
@@ -469,6 +469,7 @@
   ext: TDoubleRect;
   i: Integer;
 begin
+  if IsEmpty then exit;
   with Extent do begin
     ext.a := AxisToGraph(a);
     ext.b := AxisToGraph(b);
Index: components/tachart/tasources.pas
===================================================================
--- components/tachart/tasources.pas	(revision 61069)
+++ components/tachart/tasources.pas	(working copy)
@@ -1500,7 +1500,7 @@
     FSortDir := sdAscending;
     FSortIndex := 0;
     FSorted := false;
-    FXCount := MaxInt;
+    FXCount := MaxInt;    // Allow source to be used by any series while Origin = nil
     FYCount := MaxInt;
   end;
 
@@ -1548,7 +1548,7 @@
 
   function YByOrder(AOrderIndex: Integer): Double;
   begin
-    if AOrderIndex = 0 then
+    if AOrderIndex <= 0 then
       Result := FItem.Y
     else
       Result := FItem.YList[AOrderIndex - 1];
@@ -1559,11 +1559,14 @@
   i: Integer;
 begin
   FItem := Origin[AIndex]^;
-  SetLength(t, High(FYOrder));
-  for i := 1 to High(FYOrder) do
-    t[i - 1] := YByOrder(FYOrder[i]);
-  FItem.Y := YByOrder(FYOrder[0]);
-  FItem.YList := t;
+  if Length(FYOrder) > 0 then begin
+    SetLength(t, High(FYOrder));
+    for i := 1 to High(FYOrder) do
+      t[i - 1] := YByOrder(FYOrder[i]);
+    FItem.Y := YByOrder(FYOrder[0]);
+    FItem.YList := t;
+  end else
+    FItem.YList := nil;
 end;
 
 function TCalculatedChartSource.GetCount: Integer;
@@ -1678,7 +1681,7 @@
 begin
   if FOrigin = nil then begin
     FOriginYCount := 0;
-    FYCount := 0;
+    FYCount := MaxInt;    // Allow source to be used by any series while Origin = nil
     FYOrder := nil;
     FItem.YList := nil;
     Changed(nil);
@@ -1686,6 +1689,9 @@
   end;
 
   FOriginYCount := FOrigin.YCount;
+  if FOriginYCount = 0 then
+    FYOrder := nil
+  else
   if ReorderYList = '' then begin
     SetLength(FYOrder, FOriginYCount);
     for i := 0 to High(FYOrder) do
update_ver2.diff (3,650 bytes)

Marcin Wiazowski

2019-04-30 03:59

reporter   ~0115906

Thanks!

Issue History

Date Modified Username Field Change
2019-04-16 02:38 Marcin Wiazowski New Issue
2019-04-16 02:38 Marcin Wiazowski File Added: patch.diff
2019-04-16 09:42 wp Assigned To => wp
2019-04-16 09:42 wp Status new => assigned
2019-04-18 22:38 wp Note Added: 0115664
2019-04-19 04:33 Marcin Wiazowski Note Added: 0115666
2019-04-19 14:03 wp Note Added: 0115672
2019-04-19 17:43 wp Note Added: 0115679
2019-04-19 17:44 wp Fixed in Revision => r61020, r61022
2019-04-19 17:44 wp LazTarget => 2.2
2019-04-19 17:44 wp Status assigned => resolved
2019-04-19 17:44 wp Resolution open => fixed
2019-04-19 17:44 wp Target Version => 2.2
2019-04-27 23:16 Marcin Wiazowski File Added: Reproduce.zip
2019-04-27 23:16 Marcin Wiazowski File Added: update.diff
2019-04-27 23:17 Marcin Wiazowski Status resolved => assigned
2019-04-27 23:17 Marcin Wiazowski Resolution fixed => reopened
2019-04-27 23:17 Marcin Wiazowski Note Added: 0115860
2019-04-28 03:49 Marcin Wiazowski Note Added: 0115865
2019-04-28 19:58 Marcin Wiazowski File Added: Reproduce2.zip
2019-04-28 19:58 Marcin Wiazowski File Added: update_ver2.diff
2019-04-28 19:58 Marcin Wiazowski Note Added: 0115881
2019-04-29 10:33 wp Assigned To wp =>
2019-04-29 10:34 wp Assigned To => wp
2019-04-29 15:17 wp Status assigned => resolved
2019-04-29 15:17 wp Resolution reopened => fixed
2019-04-29 15:17 wp Fixed in Revision r61020, r61022 => r61020, r61022, 61079
2019-04-29 15:17 wp Widgetset Win32/Win64 => Win32/Win64
2019-04-30 03:59 Marcin Wiazowski Status resolved => closed
2019-04-30 03:59 Marcin Wiazowski Note Added: 0115906