mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-22 10:59:29 +02:00
Remove TAEngine unit and TSeriesList class
Auto-update chart when one of its series is destroyed patch by Alexander Klenin http://bugs.freepascal.org/view.php?id=12589 git-svn-id: trunk@17289 -
This commit is contained in:
parent
5d167a14f7
commit
cde07c30e6
1
.gitattributes
vendored
1
.gitattributes
vendored
@ -1407,7 +1407,6 @@ components/tachart/demo/unit1.lrs svneol=native#text/plain
|
||||
components/tachart/demo/unit1.pas svneol=native#text/plain
|
||||
components/tachart/tachartlazaruspkg.lpk svneol=native#text/plain
|
||||
components/tachart/tachartlazaruspkg.pas svneol=native#text/plain
|
||||
components/tachart/taengine.pas svneol=native#text/plain
|
||||
components/tachart/tagraph.lrs svneol=native#text/plain
|
||||
components/tachart/tagraph.pas svneol=native#text/plain
|
||||
components/tachart/taseries.pas svneol=native#text/plain
|
||||
|
@ -28,14 +28,10 @@
|
||||
<UnitName Value="TASeries"/>
|
||||
</Item1>
|
||||
<Item2>
|
||||
<Filename Value="taengine.pas"/>
|
||||
<UnitName Value="TAEngine"/>
|
||||
</Item2>
|
||||
<Item3>
|
||||
<Filename Value="tagraph.pas"/>
|
||||
<HasRegisterProc Value="True"/>
|
||||
<UnitName Value="TAGraph"/>
|
||||
</Item3>
|
||||
</Item2>
|
||||
</Files>
|
||||
<Type Value="RunAndDesignTime"/>
|
||||
<RequiredPkgs Count="2">
|
||||
|
@ -7,7 +7,7 @@ unit TAChartLazarusPkg;
|
||||
interface
|
||||
|
||||
uses
|
||||
TASeries, TAEngine, TAGraph, LazarusPackageIntf;
|
||||
TASeries, TAGraph, LazarusPackageIntf;
|
||||
|
||||
implementation
|
||||
|
||||
|
@ -1,54 +0,0 @@
|
||||
{
|
||||
/***************************************************************************
|
||||
TAEngine.pp
|
||||
----------
|
||||
Component Library Standard Graph Helper Functions / Classes
|
||||
|
||||
|
||||
***************************************************************************/
|
||||
|
||||
*****************************************************************************
|
||||
* *
|
||||
* See the file COPYING.modifiedLGPL.txt, included in this distribution, *
|
||||
* for details about the copyright. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
|
||||
* *
|
||||
*****************************************************************************
|
||||
|
||||
Authors: Luís Rodrigues and Philippe Martinole
|
||||
|
||||
}
|
||||
unit TAEngine;
|
||||
|
||||
interface
|
||||
|
||||
uses Classes;
|
||||
|
||||
type
|
||||
//not completetly implemented (only TPieSeries - not all)
|
||||
TSeriesMarksStyle=( smsValue, { 1234 }
|
||||
smsPercent, { 12 % }
|
||||
smsLabel, { Cars }
|
||||
smsLabelPercent, { Cars 12 % }
|
||||
smsLabelValue, { Cars 1234 }
|
||||
smsLegend, { ? }
|
||||
smsPercentTotal, { 12 % of 1234 }
|
||||
smsLabelPercentTotal, { Cars 12 % of 1234 }
|
||||
smsXValue); { 21/6/1996 }
|
||||
|
||||
|
||||
TSeriesList = class(TList)
|
||||
|
||||
private
|
||||
|
||||
// function Add(Item: TASeries): Integer; override;
|
||||
|
||||
end;
|
||||
|
||||
implementation
|
||||
|
||||
end.
|
||||
|
@ -35,7 +35,7 @@ uses
|
||||
{$ELSE}
|
||||
Windows,
|
||||
{$ENDIF}
|
||||
SysUtils, Classes, Controls, Graphics, Dialogs, StdCtrls, TAEngine, Clipbrd;
|
||||
SysUtils, Classes, Controls, Graphics, Dialogs, StdCtrls, Clipbrd;
|
||||
|
||||
const
|
||||
MinDouble=-1.7e308;
|
||||
@ -193,7 +193,7 @@ type
|
||||
TmpBrush: TBrush;
|
||||
TmpPen: TPen;
|
||||
TmpFont: TFont;
|
||||
FSeries:TSeriesList; // List of series
|
||||
FSeries: TFPList; // List of series
|
||||
FMirrorX:Boolean; // From right to left ?
|
||||
YMarkWidth:Integer; // Depend on Y marks
|
||||
FXGraphMin,FYGraphMin:Double; // Graph coordinates of limits
|
||||
@ -332,7 +332,7 @@ type
|
||||
property ChartHeight: Integer read GetChartHeight;
|
||||
property ChartWidth: Integer read GetChartWidth;
|
||||
|
||||
property Series: TSeriesList read FSeries write FSeries;
|
||||
property Series: TFPList read FSeries write FSeries;
|
||||
published
|
||||
{ Déclarations publiées }
|
||||
procedure StyleChanged(Sender: TObject);
|
||||
@ -899,7 +899,7 @@ begin
|
||||
XMarkOld:=-1;
|
||||
YMarkOld:=-1;
|
||||
|
||||
Series:=TSeriesList.Create;
|
||||
Series := TFPList.Create;
|
||||
|
||||
YMarkWidth:=10;
|
||||
|
||||
@ -952,32 +952,29 @@ end;
|
||||
|
||||
destructor TChart.Destroy;
|
||||
var
|
||||
MySerie:TChartSeries;
|
||||
i,c: integer;
|
||||
i: Integer;
|
||||
begin
|
||||
if FSeries.Count > 0 then begin
|
||||
c := FSeries.Count - 1;
|
||||
for i := 0 to c do begin
|
||||
TChartSeries(FSeries.Items[0]).Free;
|
||||
FSeries.Delete( 0 );
|
||||
end;
|
||||
end;
|
||||
for i := 0 to FSeries.Count - 1 do
|
||||
with TChartSeries(FSeries.Items[i]) do begin
|
||||
ParentChart := nil; // Prevent auto-update of the chart by series.
|
||||
Free;
|
||||
end;
|
||||
|
||||
FSeries.Free;
|
||||
FGraphBrush.Free;
|
||||
FSeries.Free;
|
||||
FGraphBrush.Free;
|
||||
|
||||
TmpBrush.Destroy;
|
||||
TmpPen.Destroy;
|
||||
TmpFont.Destroy;
|
||||
TmpBrush.Destroy;
|
||||
TmpPen.Destroy;
|
||||
TmpFont.Destroy;
|
||||
|
||||
FLegend.Destroy;
|
||||
FTitle.Destroy;
|
||||
FFoot.Destroy;
|
||||
LeftAxis.Destroy;
|
||||
BottomAxis.Destroy;
|
||||
FFrame.Destroy;
|
||||
FLegend.Destroy;
|
||||
FTitle.Destroy;
|
||||
FFoot.Destroy;
|
||||
LeftAxis.Destroy;
|
||||
BottomAxis.Destroy;
|
||||
FFrame.Destroy;
|
||||
|
||||
inherited Destroy;
|
||||
inherited Destroy;
|
||||
end;
|
||||
|
||||
procedure TChart.StyleChanged(Sender: TObject);
|
||||
|
@ -35,17 +35,29 @@ uses
|
||||
{$ELSE}
|
||||
Windows,
|
||||
{$ENDIF}
|
||||
classes, graphics, tagraph, taengine, sysutils, dialogs;
|
||||
Classes, Dialogs, Graphics, sysutils, TAGraph;
|
||||
|
||||
const
|
||||
clTAColor = clScrollBar;
|
||||
|
||||
type
|
||||
|
||||
//not completetly implemented (only TPieSeries - not all)
|
||||
TSeriesMarksStyle = (
|
||||
smsValue, { 1234 }
|
||||
smsPercent, { 12 % }
|
||||
smsLabel, { Cars }
|
||||
smsLabelPercent, { Cars 12 % }
|
||||
smsLabelValue, { Cars 1234 }
|
||||
smsLegend, { ? }
|
||||
smsPercentTotal, { 12 % of 1234 }
|
||||
smsLabelPercentTotal, { Cars 12 % of 1234 }
|
||||
smsXValue); { 21/6/1996 }
|
||||
|
||||
ChartCoord = record
|
||||
x, y: double;
|
||||
Color: tcolor;
|
||||
Text: string;
|
||||
x, y: Double;
|
||||
Color: TColor;
|
||||
Text: String;
|
||||
end;
|
||||
PChartCoord = ^ChartCoord;
|
||||
|
||||
@ -217,6 +229,8 @@ type
|
||||
property Active;
|
||||
end;
|
||||
|
||||
{ TSerie }
|
||||
|
||||
TSerie = class(TChartSeries)
|
||||
private
|
||||
FPointer: TSeriesPointer;
|
||||
@ -333,6 +347,11 @@ destructor TChartSeries.Destroy;
|
||||
var
|
||||
i: Integer;
|
||||
begin
|
||||
if ParentChart <> nil then
|
||||
ParentChart.Series.Remove(Self);
|
||||
UpdateParentChart;
|
||||
ParentChart := nil;
|
||||
|
||||
for i := 0 to FCoordList.Count - 1 do
|
||||
Dispose(PChartCoord(FCoordList.Items[i]));
|
||||
FCoordList.Free;
|
||||
@ -593,6 +612,7 @@ end;
|
||||
|
||||
destructor TSerie.Destroy;
|
||||
begin
|
||||
FPointer.Free;
|
||||
inherited Destroy;
|
||||
end;
|
||||
|
||||
@ -781,7 +801,7 @@ begin
|
||||
(yi1 >= YMin) and (yi1 <= YMax) and
|
||||
(xi1 >= XMin) and (xi1 <= XMax)
|
||||
then
|
||||
FPointer.draw(ACanvas, xi1, yi1, SeriesColor);
|
||||
FPointer.Draw(ACanvas, xi1, yi1, SeriesColor);
|
||||
end;
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user