mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-18 15:39:32 +02:00
TAChart: Add TBarSeries.ZeroLevel property
git-svn-id: trunk@27031 -
This commit is contained in:
parent
2cbeb8a186
commit
edd774a031
@ -74,12 +74,15 @@ type
|
|||||||
FBarBrush: TBrush;
|
FBarBrush: TBrush;
|
||||||
FBarPen: TPen;
|
FBarPen: TPen;
|
||||||
FBarWidthPercent: Integer;
|
FBarWidthPercent: Integer;
|
||||||
|
FZeroLevel: Double;
|
||||||
|
|
||||||
function CalcBarWidth(AX: Double; AIndex: Integer): Double;
|
function CalcBarWidth(AX: Double; AIndex: Integer): Double;
|
||||||
|
function IsZeroLevelStored: boolean;
|
||||||
procedure SetBarBrush(Value: TBrush);
|
procedure SetBarBrush(Value: TBrush);
|
||||||
procedure SetBarPen(Value: TPen);
|
procedure SetBarPen(Value: TPen);
|
||||||
procedure SetBarWidthPercent(Value: Integer);
|
procedure SetBarWidthPercent(Value: Integer);
|
||||||
procedure SetSeriesColor(AValue: TColor);
|
procedure SetSeriesColor(AValue: TColor);
|
||||||
|
procedure SetZeroLevel(AValue: Double);
|
||||||
protected
|
protected
|
||||||
procedure GetLegendItems(AItems: TChartLegendItems); override;
|
procedure GetLegendItems(AItems: TChartLegendItems); override;
|
||||||
function GetSeriesColor: TColor; override;
|
function GetSeriesColor: TColor; override;
|
||||||
@ -101,6 +104,8 @@ type
|
|||||||
read GetSeriesColor write SetSeriesColor default clTAColor;
|
read GetSeriesColor write SetSeriesColor default clTAColor;
|
||||||
property Source;
|
property Source;
|
||||||
property UseReticule;
|
property UseReticule;
|
||||||
|
property ZeroLevel: Double
|
||||||
|
read FZeroLevel write SetZeroLevel stored IsZeroLevelStored;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{ TPieSeries }
|
{ TPieSeries }
|
||||||
@ -890,9 +895,9 @@ begin
|
|||||||
p := FGraphPoints[i - FLoBound];
|
p := FGraphPoints[i - FLoBound];
|
||||||
w := CalcBarWidth(GetGraphPointX(i), i);
|
w := CalcBarWidth(GetGraphPointX(i), i);
|
||||||
if IsRotated then
|
if IsRotated then
|
||||||
graphBar := DoubleRect(AxisToGraphX(0), p.Y - w, p.X, p.Y + w)
|
graphBar := DoubleRect(AxisToGraphX(ZeroLevel), p.Y - w, p.X, p.Y + w)
|
||||||
else
|
else
|
||||||
graphBar := DoubleRect(p.X - w, AxisToGraphY(0), p.X + w, p.Y);
|
graphBar := DoubleRect(p.X - w, AxisToGraphY(ZeroLevel), p.X + w, p.Y);
|
||||||
if not RectIntersectsRect(graphBar, ext2) then continue;
|
if not RectIntersectsRect(graphBar, ext2) then continue;
|
||||||
|
|
||||||
with imageBar do begin
|
with imageBar do begin
|
||||||
@ -917,7 +922,7 @@ var
|
|||||||
begin
|
begin
|
||||||
Result := inherited Extent;
|
Result := inherited Extent;
|
||||||
if IsEmpty then exit;
|
if IsEmpty then exit;
|
||||||
UpdateMinMax(0, Result.a.Y, Result.b.Y);
|
UpdateMinMax(ZeroLevel, Result.a.Y, Result.b.Y);
|
||||||
// Show first and last bars fully.
|
// Show first and last bars fully.
|
||||||
x := GetGraphPointX(0);
|
x := GetGraphPointX(0);
|
||||||
Result.a.X := Min(Result.a.X, x - CalcBarWidth(x, 0));
|
Result.a.X := Min(Result.a.X, x - CalcBarWidth(x, 0));
|
||||||
@ -935,6 +940,11 @@ begin
|
|||||||
Result := FBarBrush.Color;
|
Result := FBarBrush.Color;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function TBarSeries.IsZeroLevelStored: boolean;
|
||||||
|
begin
|
||||||
|
Result := ZeroLevel <> 0.0;
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TBarSeries.SetBarBrush(Value: TBrush);
|
procedure TBarSeries.SetBarBrush(Value: TBrush);
|
||||||
begin
|
begin
|
||||||
FBarBrush.Assign(Value);
|
FBarBrush.Assign(Value);
|
||||||
@ -957,6 +967,13 @@ begin
|
|||||||
FBarBrush.Color := AValue;
|
FBarBrush.Color := AValue;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TBarSeries.SetZeroLevel(AValue: Double);
|
||||||
|
begin
|
||||||
|
if FZeroLevel = AValue then exit;
|
||||||
|
FZeroLevel := AValue;
|
||||||
|
UpdateParentChart;
|
||||||
|
end;
|
||||||
|
|
||||||
{ TPieSeries }
|
{ TPieSeries }
|
||||||
|
|
||||||
function TPieSeries.AddPie(Value: Double; Text: String; Color: TColor): Longint;
|
function TPieSeries.AddPie(Value: Double; Text: String; Color: TColor): Longint;
|
||||||
|
Loading…
Reference in New Issue
Block a user