mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-26 20:40:36 +02:00
TAChart: Add TCustomAxisChartSource
git-svn-id: trunk@38662 -
This commit is contained in:
parent
1ef9f780a2
commit
71bbfef4d6
1
.gitattributes
vendored
1
.gitattributes
vendored
@ -3017,6 +3017,7 @@ components/tachart/numlib_fix/mdt.pas svneol=native#text/pascal
|
||||
components/tachart/numlib_fix/sle.pas svneol=native#text/pascal
|
||||
components/tachart/numlib_fix/spe.pas svneol=native#text/pascal
|
||||
components/tachart/taanimatedsource.pas svneol=native#text/pascal
|
||||
components/tachart/taaxissource.pas svneol=native#text/pascal
|
||||
components/tachart/tachartaggpas.lpk svneol=native#text/pascal
|
||||
components/tachart/tachartaggpas.pas svneol=native#text/pascal
|
||||
components/tachart/tachartaxis.pas svneol=native#text/pascal
|
||||
|
104
components/tachart/taaxissource.pas
Normal file
104
components/tachart/taaxissource.pas
Normal file
@ -0,0 +1,104 @@
|
||||
{
|
||||
|
||||
*****************************************************************************
|
||||
* *
|
||||
* 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: Alexander Klenin
|
||||
|
||||
}
|
||||
|
||||
unit TAAxisSource;
|
||||
|
||||
{$H+}
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
Classes, TACustomSource, TAChartAxis;
|
||||
|
||||
type
|
||||
TCustomAxisChartSource = class(TCustomChartSource)
|
||||
strict private
|
||||
FAxisFrom: TChartAxis;
|
||||
FAxisTo: TChartAxis;
|
||||
FItem: TChartDataItem;
|
||||
protected
|
||||
function GetCount: Integer; override;
|
||||
function GetItem(AIndex: Integer): PChartDataItem; override;
|
||||
procedure SetYCount(AValue: Cardinal); override;
|
||||
public
|
||||
constructor Create(AOwner: TComponent); override;
|
||||
destructor Destroy; override;
|
||||
public
|
||||
function IsSorted: Boolean; override;
|
||||
|
||||
property AxisFrom: TChartAxis read FAxisFrom write FAxisFrom;
|
||||
property AxisTo: TChartAxis read FAxisTo write FAxisTo;
|
||||
end;
|
||||
|
||||
implementation
|
||||
|
||||
uses
|
||||
TAChartUtils;
|
||||
|
||||
{ TCustomAxisChartSource }
|
||||
|
||||
constructor TCustomAxisChartSource.Create(AOwner: TComponent);
|
||||
begin
|
||||
inherited Create(AOwner);
|
||||
FItem.Color := clTAColor;
|
||||
FItem.YList := nil;
|
||||
end;
|
||||
|
||||
destructor TCustomAxisChartSource.Destroy;
|
||||
begin
|
||||
inherited Destroy;
|
||||
end;
|
||||
|
||||
function TCustomAxisChartSource.GetCount: Integer;
|
||||
begin
|
||||
if AxisFrom = nil then
|
||||
Result := 0
|
||||
else
|
||||
Result := AxisFrom.ValueCount;
|
||||
end;
|
||||
|
||||
function TCustomAxisChartSource.GetItem(AIndex: Integer): PChartDataItem;
|
||||
var
|
||||
v: Double;
|
||||
begin
|
||||
Result := @FItem;
|
||||
if AxisFrom = nil then exit;
|
||||
with AxisFrom.Value[AIndex] do begin
|
||||
FItem.Text := FText;
|
||||
v := FValue;
|
||||
end;
|
||||
if AxisFrom.Transformations <> nil then
|
||||
v := AxisFrom.Transformations.AxisToGraph(v);
|
||||
if (AxisTo <> nil) and (AxisTo.Transformations <> nil) then
|
||||
v := AxisTo.Transformations.GraphToAxis(v);
|
||||
FItem.X := v;
|
||||
FItem.Y := v;
|
||||
end;
|
||||
|
||||
function TCustomAxisChartSource.IsSorted: Boolean;
|
||||
begin
|
||||
Result := true;
|
||||
end;
|
||||
|
||||
procedure TCustomAxisChartSource.SetYCount(AValue: Cardinal);
|
||||
begin
|
||||
Unused(AValue);
|
||||
raise EYCountError.Create('Can not set YCount');
|
||||
end;
|
||||
|
||||
end.
|
||||
|
@ -34,7 +34,7 @@
|
||||
for details about the copyright.
|
||||
"/>
|
||||
<Version Major="1"/>
|
||||
<Files Count="40">
|
||||
<Files Count="41">
|
||||
<Item1>
|
||||
<Filename Value="tagraph.pas"/>
|
||||
<HasRegisterProc Value="True"/>
|
||||
@ -213,6 +213,10 @@
|
||||
<Filename Value="tatextelements.pas"/>
|
||||
<UnitName Value="TATextElements"/>
|
||||
</Item40>
|
||||
<Item41>
|
||||
<Filename Value="taaxissource.pas"/>
|
||||
<UnitName Value="TAAxisSource"/>
|
||||
</Item41>
|
||||
</Files>
|
||||
<LazDoc Paths="$(LazarusDir)\components\tachart\fpdoc"/>
|
||||
<Type Value="RunAndDesignTime"/>
|
||||
|
@ -14,7 +14,7 @@ uses
|
||||
TADrawerCanvas, TADrawerSVG, TAIntervalSources, TAChartAxisUtils,
|
||||
TAChartListbox, TAEnumerators, TADataPointsEditor, TAChartExtentLink,
|
||||
TAToolEditors, TAMath, TAChartImageList, TADataTools, TAAnimatedSource,
|
||||
TATextElements, LazarusPackageIntf;
|
||||
TATextElements, TAAxisSource, LazarusPackageIntf;
|
||||
|
||||
implementation
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user