TAChart: Declare the chartsource's XCount and YCount to be Integer, not Cardinal.

git-svn-id: trunk@60446 -
This commit is contained in:
wp 2019-02-18 15:35:14 +00:00
parent cf88b3536a
commit 0ec4d4477b
7 changed files with 39 additions and 41 deletions

View File

@ -48,8 +48,8 @@ type
protected protected
function GetCount: Integer; override; function GetCount: Integer; override;
function GetItem(AIndex: Integer): PChartDataItem; override; function GetItem(AIndex: Integer): PChartDataItem; override;
procedure SetXCount(AValue: Cardinal); override; procedure SetXCount(AValue: Integer); override;
procedure SetYCount(AValue: Cardinal); override; procedure SetYCount(AValue: Integer); override;
public public
constructor Create(AOwner: TComponent); override; constructor Create(AOwner: TComponent); override;
destructor Destroy; override; destructor Destroy; override;
@ -189,13 +189,13 @@ begin
FOrigin.Broadcaster.Subscribe(FListener); FOrigin.Broadcaster.Subscribe(FListener);
end; end;
procedure TCustomAnimatedChartSource.SetXCount(AValue: Cardinal); procedure TCustomAnimatedChartSource.SetXCount(AValue: Integer);
begin begin
Unused(AValue); Unused(AValue);
raise EXCountError.Create('Cannot set XCount'); raise EXCountError.Create('Cannot set XCount');
end; end;
procedure TCustomAnimatedChartSource.SetYCount(AValue: Cardinal); procedure TCustomAnimatedChartSource.SetYCount(AValue: Integer);
begin begin
Unused(AValue); Unused(AValue);
raise EYCountError.Create('Cannot set YCount'); raise EYCountError.Create('Cannot set YCount');

View File

@ -27,8 +27,8 @@ type
protected protected
function GetCount: Integer; override; function GetCount: Integer; override;
function GetItem(AIndex: Integer): PChartDataItem; override; function GetItem(AIndex: Integer): PChartDataItem; override;
procedure SetXCount(AValue: Cardinal); override; procedure SetXCount(AValue: Integer); override;
procedure SetYCount(AValue: Cardinal); override; procedure SetYCount(AValue: Integer); override;
public public
constructor Create(AOwner: TComponent); override; constructor Create(AOwner: TComponent); override;
destructor Destroy; override; destructor Destroy; override;
@ -89,13 +89,13 @@ begin
Result := true; Result := true;
end; end;
procedure TCustomAxisChartSource.SetXCount(AValue: Cardinal); procedure TCustomAxisChartSource.SetXCount(AValue: Integer);
begin begin
Unused(AValue); Unused(AValue);
raise EXCountError.Create('Cannot set XCount'); raise EXCountError.Create('Cannot set XCount');
end; end;
procedure TCustomAxisChartSource.SetYCount(AValue: Cardinal); procedure TCustomAxisChartSource.SetYCount(AValue: Integer);
begin begin
Unused(AValue); Unused(AValue);
raise EYCountError.Create('Cannot set YCount'); raise EYCountError.Create('Cannot set YCount');

View File

@ -190,8 +190,8 @@ type
FExtentIsValid: Boolean; FExtentIsValid: Boolean;
FValuesTotal: Double; FValuesTotal: Double;
FValuesTotalIsValid: Boolean; FValuesTotalIsValid: Boolean;
FXCount: Cardinal; FXCount: Integer;
FYCount: Cardinal; FYCount: Integer;
procedure ChangeErrorBars(Sender: TObject); virtual; procedure ChangeErrorBars(Sender: TObject); virtual;
function GetCount: Integer; virtual; abstract; function GetCount: Integer; virtual; abstract;
function GetErrorBarValues(APointIndex: Integer; Which: Integer; function GetErrorBarValues(APointIndex: Integer; Which: Integer;
@ -199,8 +199,8 @@ type
function GetHasErrorBars(Which: Integer): Boolean; function GetHasErrorBars(Which: Integer): Boolean;
function GetItem(AIndex: Integer): PChartDataItem; virtual; abstract; function GetItem(AIndex: Integer): PChartDataItem; virtual; abstract;
procedure InvalidateCaches; procedure InvalidateCaches;
procedure SetXCount(AValue: Cardinal); virtual; abstract; procedure SetXCount(AValue: Integer); virtual; abstract;
procedure SetYCount(AValue: Cardinal); virtual; abstract; procedure SetYCount(AValue: Integer); virtual; abstract;
property XErrorBarData: TChartErrorBarData index 0 read GetErrorBarData property XErrorBarData: TChartErrorBarData index 0 read GetErrorBarData
write SetErrorBarData stored IsErrorBarDataStored; write SetErrorBarData stored IsErrorBarDataStored;
property YErrorBarData: TChartErrorBarData index 1 read GetErrorBarData property YErrorBarData: TChartErrorBarData index 1 read GetErrorBarData
@ -245,8 +245,8 @@ type
property Count: Integer read GetCount; property Count: Integer read GetCount;
property Item[AIndex: Integer]: PChartDataItem read GetItem; default; property Item[AIndex: Integer]: PChartDataItem read GetItem; default;
property XCount: Cardinal read FXCount write SetXCount default 1; property XCount: Integer read FXCount write SetXCount default 1;
property YCount: Cardinal read FYCount write SetYCount default 1; property YCount: Integer read FYCount write SetYCount default 1;
end; end;
{ TChartSourceBuffer } { TChartSourceBuffer }

View File

@ -52,7 +52,7 @@ type
protected protected
function GetCount: Integer; override; function GetCount: Integer; override;
function GetItem(AIndex: Integer): PChartDataItem; override; function GetItem(AIndex: Integer): PChartDataItem; override;
procedure SetYCount(AValue: Cardinal); override; procedure SetYCount(AValue: Integer); override;
public public
constructor Create(AOwner: TComponent); override; constructor Create(AOwner: TComponent); override;
destructor Destroy; override; destructor Destroy; override;
@ -322,7 +322,7 @@ begin
Reset; Reset;
end; end;
procedure TDbChartSource.SetYCount(AValue: Cardinal); procedure TDbChartSource.SetYCount(AValue: Integer);
begin begin
Unused(AValue); Unused(AValue);
raise EYCountError.Create('Set FieldY instead'); raise EYCountError.Create('Set FieldY instead');

View File

@ -32,8 +32,8 @@ type
protected protected
function GetCount: Integer; override; function GetCount: Integer; override;
function GetItem(AIndex: Integer): PChartDataItem; override; function GetItem(AIndex: Integer): PChartDataItem; override;
procedure SetXCount(AValue: Cardinal); override; procedure SetXCount(AValue: Integer); override;
procedure SetYCount(AValue: Cardinal); override; procedure SetYCount(AValue: Integer); override;
public public
constructor Create(AOwner: TComponent); override; constructor Create(AOwner: TComponent); override;
destructor Destroy; override; destructor Destroy; override;
@ -363,13 +363,13 @@ begin
Notify; Notify;
end; end;
procedure TIntervalChartSource.SetXCount(AValue: Cardinal); procedure TIntervalChartSource.SetXCount(AValue: Integer);
begin begin
Unused(AValue); Unused(AValue);
raise EXCountError.Create('Cannot set XCount'); raise EXCountError.Create('Cannot set XCount');
end; end;
procedure TIntervalChartSource.SetYCount(AValue: Cardinal); procedure TIntervalChartSource.SetYCount(AValue: Integer);
begin begin
Unused(AValue); Unused(AValue);
raise EYCountError.Create('Cannot set YCount'); raise EYCountError.Create('Cannot set YCount');

View File

@ -633,7 +633,6 @@ var
R: TRect; R: TRect;
RArray: array[0..3] of Integer absolute R; RArray: array[0..3] of Integer absolute R;
isneg: Boolean; isneg: Boolean;
p: Integer;
dir: TLabelDirection; dir: TLabelDirection;
begin begin
if (AYIndex = 1) and GetBubbleRect(Source.Item[AIndex + FLoBound], R) then begin if (AYIndex = 1) and GetBubbleRect(Source.Item[AIndex + FLoBound], R) then begin
@ -875,7 +874,6 @@ var
gp: TDoublePoint; gp: TDoublePoint;
scMarksDistance: Integer; scMarksDistance: Integer;
center: Double; center: Double;
ysum: Double;
begin begin
if not Marks.IsMarkLabelsVisible or not Marks.AutoMargins then exit; if not Marks.IsMarkLabelsVisible or not Marks.AutoMargins then exit;
if Count = 0 then exit; if Count = 0 then exit;
@ -1430,7 +1428,7 @@ procedure TOpenHighLowCloseSeries.Draw(ADrawer: IChartDrawer);
end; end;
var var
my: Cardinal; my: Integer;
ext2: TDoubleRect; ext2: TDoubleRect;
i: Integer; i: Integer;
x, tw, yopen, yhigh, ylow, yclose: Double; x, tw, yopen, yhigh, ylow, yclose: Double;

View File

@ -37,8 +37,8 @@ type
protected protected
function GetCount: Integer; override; function GetCount: Integer; override;
function GetItem(AIndex: Integer): PChartDataItem; override; function GetItem(AIndex: Integer): PChartDataItem; override;
procedure SetXCount(AValue: Cardinal); override; procedure SetXCount(AValue: Integer); override;
procedure SetYCount(AValue: Cardinal); override; procedure SetYCount(AValue: Integer); override;
public public
type type
EXListEmptyError = class(EChartError); EXListEmptyError = class(EChartError);
@ -123,8 +123,8 @@ type
procedure ChangeErrorBars(Sender: TObject); override; procedure ChangeErrorBars(Sender: TObject); override;
function GetCount: Integer; override; function GetCount: Integer; override;
function GetItem(AIndex: Integer): PChartDataItem; override; function GetItem(AIndex: Integer): PChartDataItem; override;
procedure SetXCount(AValue: Cardinal); override; procedure SetXCount(AValue: Integer); override;
procedure SetYCount(AValue: Cardinal); override; procedure SetYCount(AValue: Integer); override;
public public
constructor Create(AOwner: TComponent); override; constructor Create(AOwner: TComponent); override;
destructor Destroy; override; destructor Destroy; override;
@ -165,8 +165,8 @@ type
protected protected
function GetCount: Integer; override; function GetCount: Integer; override;
function GetItem(AIndex: Integer): PChartDataItem; override; function GetItem(AIndex: Integer): PChartDataItem; override;
procedure SetXCount(AValue: Cardinal); override; procedure SetXCount(AValue: Integer); override;
procedure SetYCount(AValue: Cardinal); override; procedure SetYCount(AValue: Integer); override;
public public
procedure EndUpdate; override; procedure EndUpdate; override;
function IsSorted: Boolean; override; function IsSorted: Boolean; override;
@ -197,7 +197,7 @@ type
FItem: TChartDataItem; FItem: TChartDataItem;
FListener: TListener; FListener: TListener;
FOrigin: TCustomChartSource; FOrigin: TCustomChartSource;
FOriginYCount: Cardinal; FOriginYCount: Integer;
FPercentage: Boolean; FPercentage: Boolean;
FReorderYList: String; FReorderYList: String;
FYOrder: array of Integer; FYOrder: array of Integer;
@ -220,8 +220,8 @@ type
protected protected
function GetCount: Integer; override; function GetCount: Integer; override;
function GetItem(AIndex: Integer): PChartDataItem; override; function GetItem(AIndex: Integer): PChartDataItem; override;
procedure SetXCount(AValue: Cardinal); override; procedure SetXCount(AValue: Integer); override;
procedure SetYCount(AValue: Cardinal); override; procedure SetYCount(AValue: Integer); override;
public public
constructor Create(AOwner: TComponent); override; constructor Create(AOwner: TComponent); override;
destructor Destroy; override; destructor Destroy; override;
@ -350,7 +350,7 @@ var
begin begin
parts := Split(AString); parts := Split(AString);
try try
if (FSource.XCount = 1) and (FSource.YCount + 3 < Cardinal(parts.Count)) then if (FSource.XCount = 1) and (FSource.YCount + 3 < parts.Count) then
FSource.YCount := parts.Count - 3; FSource.YCount := parts.Count - 3;
with ADataItem^ do begin with ADataItem^ do begin
X := StrToFloatOrDateTimeDef(NextPart); X := StrToFloatOrDateTimeDef(NextPart);
@ -575,7 +575,7 @@ begin
Notify; Notify;
end; end;
procedure TListChartSource.SetXCount(AValue: Cardinal); procedure TListChartSource.SetXCount(AValue: Integer);
var var
i: Integer; i: Integer;
begin begin
@ -649,7 +649,7 @@ begin
Notify; Notify;
end; end;
procedure TListChartSource.SetYCount(AValue: Cardinal); procedure TListChartSource.SetYCount(AValue: Integer);
var var
i: Integer; i: Integer;
begin begin
@ -935,7 +935,7 @@ begin
Reset; Reset;
end; end;
procedure TRandomChartSource.SetXCount(AValue: Cardinal); procedure TRandomChartSource.SetXCount(AValue: Integer);
begin begin
if XCount = AValue then exit; if XCount = AValue then exit;
FXCount := AValue; FXCount := AValue;
@ -956,7 +956,7 @@ begin
Reset; Reset;
end; end;
procedure TRandomChartSource.SetYCount(AValue: Cardinal); procedure TRandomChartSource.SetYCount(AValue: Integer);
begin begin
if YCount = AValue then exit; if YCount = AValue then exit;
FYCount := AValue; FYCount := AValue;
@ -1034,7 +1034,7 @@ begin
Reset; Reset;
end; end;
procedure TUserDefinedChartSource.SetXCount(AValue: Cardinal); procedure TUserDefinedChartSource.SetXCount(AValue: Integer);
begin begin
if FXCount = AValue then exit; if FXCount = AValue then exit;
FXCount := AValue; FXCount := AValue;
@ -1042,7 +1042,7 @@ begin
Reset; Reset;
end; end;
procedure TUserDefinedChartSource.SetYCount(AValue: Cardinal); procedure TUserDefinedChartSource.SetYCount(AValue: Integer);
begin begin
if FYCount = AValue then exit; if FYCount = AValue then exit;
FYCount := AValue; FYCount := AValue;
@ -1372,13 +1372,13 @@ begin
UpdateYOrder; UpdateYOrder;
end; end;
procedure TCalculatedChartSource.SetXCount(AValue: Cardinal); procedure TCalculatedChartSource.SetXCount(AValue: Integer);
begin begin
Unused(AValue); Unused(AValue);
raise EXCountError.Create('Cannot set XCount'); raise EXCountError.Create('Cannot set XCount');
end; end;
procedure TCalculatedChartSource.SetYCount(AValue: Cardinal); procedure TCalculatedChartSource.SetYCount(AValue: Integer);
begin begin
Unused(AValue); Unused(AValue);
raise EYCountError.Create('Cannot set YCount'); raise EYCountError.Create('Cannot set YCount');