mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-14 21:39:11 +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/demo/unit1.pas svneol=native#text/plain
|
||||||
components/tachart/tachartlazaruspkg.lpk svneol=native#text/plain
|
components/tachart/tachartlazaruspkg.lpk svneol=native#text/plain
|
||||||
components/tachart/tachartlazaruspkg.pas 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.lrs svneol=native#text/plain
|
||||||
components/tachart/tagraph.pas svneol=native#text/plain
|
components/tachart/tagraph.pas svneol=native#text/plain
|
||||||
components/tachart/taseries.pas svneol=native#text/plain
|
components/tachart/taseries.pas svneol=native#text/plain
|
||||||
|
@ -28,14 +28,10 @@
|
|||||||
<UnitName Value="TASeries"/>
|
<UnitName Value="TASeries"/>
|
||||||
</Item1>
|
</Item1>
|
||||||
<Item2>
|
<Item2>
|
||||||
<Filename Value="taengine.pas"/>
|
|
||||||
<UnitName Value="TAEngine"/>
|
|
||||||
</Item2>
|
|
||||||
<Item3>
|
|
||||||
<Filename Value="tagraph.pas"/>
|
<Filename Value="tagraph.pas"/>
|
||||||
<HasRegisterProc Value="True"/>
|
<HasRegisterProc Value="True"/>
|
||||||
<UnitName Value="TAGraph"/>
|
<UnitName Value="TAGraph"/>
|
||||||
</Item3>
|
</Item2>
|
||||||
</Files>
|
</Files>
|
||||||
<Type Value="RunAndDesignTime"/>
|
<Type Value="RunAndDesignTime"/>
|
||||||
<RequiredPkgs Count="2">
|
<RequiredPkgs Count="2">
|
||||||
|
@ -7,7 +7,7 @@ unit TAChartLazarusPkg;
|
|||||||
interface
|
interface
|
||||||
|
|
||||||
uses
|
uses
|
||||||
TASeries, TAEngine, TAGraph, LazarusPackageIntf;
|
TASeries, TAGraph, LazarusPackageIntf;
|
||||||
|
|
||||||
implementation
|
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}
|
{$ELSE}
|
||||||
Windows,
|
Windows,
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
SysUtils, Classes, Controls, Graphics, Dialogs, StdCtrls, TAEngine, Clipbrd;
|
SysUtils, Classes, Controls, Graphics, Dialogs, StdCtrls, Clipbrd;
|
||||||
|
|
||||||
const
|
const
|
||||||
MinDouble=-1.7e308;
|
MinDouble=-1.7e308;
|
||||||
@ -193,7 +193,7 @@ type
|
|||||||
TmpBrush: TBrush;
|
TmpBrush: TBrush;
|
||||||
TmpPen: TPen;
|
TmpPen: TPen;
|
||||||
TmpFont: TFont;
|
TmpFont: TFont;
|
||||||
FSeries:TSeriesList; // List of series
|
FSeries: TFPList; // List of series
|
||||||
FMirrorX:Boolean; // From right to left ?
|
FMirrorX:Boolean; // From right to left ?
|
||||||
YMarkWidth:Integer; // Depend on Y marks
|
YMarkWidth:Integer; // Depend on Y marks
|
||||||
FXGraphMin,FYGraphMin:Double; // Graph coordinates of limits
|
FXGraphMin,FYGraphMin:Double; // Graph coordinates of limits
|
||||||
@ -332,7 +332,7 @@ type
|
|||||||
property ChartHeight: Integer read GetChartHeight;
|
property ChartHeight: Integer read GetChartHeight;
|
||||||
property ChartWidth: Integer read GetChartWidth;
|
property ChartWidth: Integer read GetChartWidth;
|
||||||
|
|
||||||
property Series: TSeriesList read FSeries write FSeries;
|
property Series: TFPList read FSeries write FSeries;
|
||||||
published
|
published
|
||||||
{ Déclarations publiées }
|
{ Déclarations publiées }
|
||||||
procedure StyleChanged(Sender: TObject);
|
procedure StyleChanged(Sender: TObject);
|
||||||
@ -899,7 +899,7 @@ begin
|
|||||||
XMarkOld:=-1;
|
XMarkOld:=-1;
|
||||||
YMarkOld:=-1;
|
YMarkOld:=-1;
|
||||||
|
|
||||||
Series:=TSeriesList.Create;
|
Series := TFPList.Create;
|
||||||
|
|
||||||
YMarkWidth:=10;
|
YMarkWidth:=10;
|
||||||
|
|
||||||
@ -952,32 +952,29 @@ end;
|
|||||||
|
|
||||||
destructor TChart.Destroy;
|
destructor TChart.Destroy;
|
||||||
var
|
var
|
||||||
MySerie:TChartSeries;
|
i: Integer;
|
||||||
i,c: integer;
|
|
||||||
begin
|
begin
|
||||||
if FSeries.Count > 0 then begin
|
for i := 0 to FSeries.Count - 1 do
|
||||||
c := FSeries.Count - 1;
|
with TChartSeries(FSeries.Items[i]) do begin
|
||||||
for i := 0 to c do begin
|
ParentChart := nil; // Prevent auto-update of the chart by series.
|
||||||
TChartSeries(FSeries.Items[0]).Free;
|
Free;
|
||||||
FSeries.Delete( 0 );
|
end;
|
||||||
end;
|
|
||||||
end;
|
|
||||||
|
|
||||||
FSeries.Free;
|
FSeries.Free;
|
||||||
FGraphBrush.Free;
|
FGraphBrush.Free;
|
||||||
|
|
||||||
TmpBrush.Destroy;
|
TmpBrush.Destroy;
|
||||||
TmpPen.Destroy;
|
TmpPen.Destroy;
|
||||||
TmpFont.Destroy;
|
TmpFont.Destroy;
|
||||||
|
|
||||||
FLegend.Destroy;
|
FLegend.Destroy;
|
||||||
FTitle.Destroy;
|
FTitle.Destroy;
|
||||||
FFoot.Destroy;
|
FFoot.Destroy;
|
||||||
LeftAxis.Destroy;
|
LeftAxis.Destroy;
|
||||||
BottomAxis.Destroy;
|
BottomAxis.Destroy;
|
||||||
FFrame.Destroy;
|
FFrame.Destroy;
|
||||||
|
|
||||||
inherited Destroy;
|
inherited Destroy;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TChart.StyleChanged(Sender: TObject);
|
procedure TChart.StyleChanged(Sender: TObject);
|
||||||
|
@ -35,17 +35,29 @@ uses
|
|||||||
{$ELSE}
|
{$ELSE}
|
||||||
Windows,
|
Windows,
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
classes, graphics, tagraph, taengine, sysutils, dialogs;
|
Classes, Dialogs, Graphics, sysutils, TAGraph;
|
||||||
|
|
||||||
const
|
const
|
||||||
clTAColor = clScrollBar;
|
clTAColor = clScrollBar;
|
||||||
|
|
||||||
type
|
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
|
ChartCoord = record
|
||||||
x, y: double;
|
x, y: Double;
|
||||||
Color: tcolor;
|
Color: TColor;
|
||||||
Text: string;
|
Text: String;
|
||||||
end;
|
end;
|
||||||
PChartCoord = ^ChartCoord;
|
PChartCoord = ^ChartCoord;
|
||||||
|
|
||||||
@ -217,6 +229,8 @@ type
|
|||||||
property Active;
|
property Active;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
{ TSerie }
|
||||||
|
|
||||||
TSerie = class(TChartSeries)
|
TSerie = class(TChartSeries)
|
||||||
private
|
private
|
||||||
FPointer: TSeriesPointer;
|
FPointer: TSeriesPointer;
|
||||||
@ -333,6 +347,11 @@ destructor TChartSeries.Destroy;
|
|||||||
var
|
var
|
||||||
i: Integer;
|
i: Integer;
|
||||||
begin
|
begin
|
||||||
|
if ParentChart <> nil then
|
||||||
|
ParentChart.Series.Remove(Self);
|
||||||
|
UpdateParentChart;
|
||||||
|
ParentChart := nil;
|
||||||
|
|
||||||
for i := 0 to FCoordList.Count - 1 do
|
for i := 0 to FCoordList.Count - 1 do
|
||||||
Dispose(PChartCoord(FCoordList.Items[i]));
|
Dispose(PChartCoord(FCoordList.Items[i]));
|
||||||
FCoordList.Free;
|
FCoordList.Free;
|
||||||
@ -593,6 +612,7 @@ end;
|
|||||||
|
|
||||||
destructor TSerie.Destroy;
|
destructor TSerie.Destroy;
|
||||||
begin
|
begin
|
||||||
|
FPointer.Free;
|
||||||
inherited Destroy;
|
inherited Destroy;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -781,7 +801,7 @@ begin
|
|||||||
(yi1 >= YMin) and (yi1 <= YMax) and
|
(yi1 >= YMin) and (yi1 <= YMax) and
|
||||||
(xi1 >= XMin) and (xi1 <= XMax)
|
(xi1 >= XMin) and (xi1 <= XMax)
|
||||||
then
|
then
|
||||||
FPointer.draw(ACanvas, xi1, yi1, SeriesColor);
|
FPointer.Draw(ACanvas, xi1, yi1, SeriesColor);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user