View Issue Details

IDProjectCategoryView StatusLast Update
0035387LazarusTAChartpublic2019-04-16 18:07
ReporterMarcin WiazowskiAssigned Towp 
PrioritynormalSeverityminorReproducibilityalways
Status closedResolutionfixed 
Product Version2.1 (SVN)Product Build60989 
Target Version2.2Fixed in Version 
Summary0035387: TAChart: fix for lacking initialization/resetting in TCustomAxisChartSource
DescriptionAfter applying the attached patch:

1) in the constructor, XList is now explicitly initialized,

2) in GetItem() some code was added, to avoid returning cached data, when the axis has been already unassigned.
TagsNo tags attached.
Fixed in Revision60997
LazTarget2.2
WidgetsetWin32/Win64
Attached Files
  • patch.diff (1,170 bytes)
    Index: components/tachart/taaxissource.pas
    ===================================================================
    --- components/tachart/taaxissource.pas	(revision 60988)
    +++ components/tachart/taaxissource.pas	(working copy)
    @@ -31,7 +31,6 @@
         procedure SetYCount(AValue: Cardinal); override;
       public
         constructor Create(AOwner: TComponent); override;
    -    destructor Destroy; override;
       public
         function IsSorted: Boolean; override;
     
    @@ -42,7 +41,7 @@
     implementation
     
     uses
    -  TAChartUtils;
    +  TAChartUtils, Math;
     
     { TCustomAxisChartSource }
     
    @@ -50,14 +49,10 @@
     begin
       inherited Create(AOwner);
       FItem.Color := clTAColor;
    +  FItem.XList := nil;
       FItem.YList := nil;
     end;
     
    -destructor TCustomAxisChartSource.Destroy;
    -begin
    -  inherited Destroy;
    -end;
    -
     function TCustomAxisChartSource.GetCount: Integer;
     begin
       if AxisFrom = nil then
    @@ -71,7 +66,12 @@
       v: Double;
     begin
       Result := @FItem;
    -  if AxisFrom = nil then exit;
    +  if AxisFrom = nil then begin
    +    FItem.Text := '';
    +    FItem.X := NaN;
    +    FItem.Y := NaN;
    +    exit;
    +  end;
       with AxisFrom.Value[AIndex] do begin
         FItem.Text := FText;
         v := FValue;
    
    patch.diff (1,170 bytes)

Activities

Marcin Wiazowski

2019-04-16 02:35

reporter  

patch.diff (1,170 bytes)
Index: components/tachart/taaxissource.pas
===================================================================
--- components/tachart/taaxissource.pas	(revision 60988)
+++ components/tachart/taaxissource.pas	(working copy)
@@ -31,7 +31,6 @@
     procedure SetYCount(AValue: Cardinal); override;
   public
     constructor Create(AOwner: TComponent); override;
-    destructor Destroy; override;
   public
     function IsSorted: Boolean; override;
 
@@ -42,7 +41,7 @@
 implementation
 
 uses
-  TAChartUtils;
+  TAChartUtils, Math;
 
 { TCustomAxisChartSource }
 
@@ -50,14 +49,10 @@
 begin
   inherited Create(AOwner);
   FItem.Color := clTAColor;
+  FItem.XList := nil;
   FItem.YList := nil;
 end;
 
-destructor TCustomAxisChartSource.Destroy;
-begin
-  inherited Destroy;
-end;
-
 function TCustomAxisChartSource.GetCount: Integer;
 begin
   if AxisFrom = nil then
@@ -71,7 +66,12 @@
   v: Double;
 begin
   Result := @FItem;
-  if AxisFrom = nil then exit;
+  if AxisFrom = nil then begin
+    FItem.Text := '';
+    FItem.X := NaN;
+    FItem.Y := NaN;
+    exit;
+  end;
   with AxisFrom.Value[AIndex] do begin
     FItem.Text := FText;
     v := FValue;
patch.diff (1,170 bytes)

wp

2019-04-16 17:20

developer   ~0115555

Done, thanks.

Marcin Wiazowski

2019-04-16 18:07

reporter   ~0115558

Thanks!

Issue History

Date Modified Username Field Change
2019-04-16 02:35 Marcin Wiazowski New Issue
2019-04-16 02:35 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-16 17:20 wp Fixed in Revision => 60997
2019-04-16 17:20 wp LazTarget => 2.2
2019-04-16 17:20 wp Note Added: 0115555
2019-04-16 17:20 wp Status assigned => resolved
2019-04-16 17:20 wp Resolution open => fixed
2019-04-16 17:20 wp Target Version => 2.2
2019-04-16 18:07 Marcin Wiazowski Note Added: 0115558
2019-04-16 18:07 Marcin Wiazowski Status resolved => closed