mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-11-07 08:29:45 +01:00
TAChart: Add TChartPen.EffVisible helper function
git-svn-id: trunk@41781 -
This commit is contained in:
parent
16c8144a5d
commit
f4fb26c786
@ -732,7 +732,7 @@ end;
|
|||||||
function TChartSeries.GetGraphPoint(AIndex: Integer): TDoublePoint;
|
function TChartSeries.GetGraphPoint(AIndex: Integer): TDoublePoint;
|
||||||
begin
|
begin
|
||||||
Result.X := GetGraphPointX(AIndex);
|
Result.X := GetGraphPointX(AIndex);
|
||||||
Result.Y := GetGraphPointY(AIndex);;
|
Result.Y := GetGraphPointY(AIndex);
|
||||||
if IsRotated then
|
if IsRotated then
|
||||||
Exchange(Result.X, Result.Y);
|
Exchange(Result.X, Result.Y);
|
||||||
end;
|
end;
|
||||||
|
|||||||
@ -424,7 +424,7 @@ var
|
|||||||
begin
|
begin
|
||||||
inherited Draw(ADrawer, ARect);
|
inherited Draw(ADrawer, ARect);
|
||||||
with FFramePen do
|
with FFramePen do
|
||||||
pw := IfThen(Visible and (Style <> psClear), (Width + 1) div 2, 0);
|
pw := IfThen(EffVisible, (Width + 1) div 2, 0);
|
||||||
w := ARect.Right - ARect.Left - 2 * pw;
|
w := ARect.Right - ARect.Left - 2 * pw;
|
||||||
if w <= 0 then exit;
|
if w <= 0 then exit;
|
||||||
for x := ARect.Left + pw to ARect.Right - pw do begin
|
for x := ARect.Left + pw to ARect.Right - pw do begin
|
||||||
@ -1013,17 +1013,15 @@ procedure TCubicSplineSeries.Draw(ADrawer: IChartDrawer);
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
procedure DrawSpline(ASpline: TSpline);
|
procedure DrawSpline(ASpline: TSpline);
|
||||||
var
|
|
||||||
p: TChartPen;
|
|
||||||
begin
|
begin
|
||||||
if ASpline.FIsUnorderedX then begin
|
if ASpline.FIsUnorderedX then begin
|
||||||
if not IsUnorderedVisible then exit;
|
if not IsUnorderedVisible then exit;
|
||||||
p := BadDataPen;
|
ADrawer.Pen := BadDataPen;
|
||||||
end
|
end
|
||||||
else
|
else begin
|
||||||
p := Pen;
|
if not Pen.EffVisible then exit;
|
||||||
if not p.Visible or (p.Style = psClear) then exit;
|
ADrawer.Pen := Pen;
|
||||||
ADrawer.Pen := p;
|
end;
|
||||||
with TDrawFuncHelper.Create(Self, ASpline.FIntervals, @ASpline.Calculate, Step) do
|
with TDrawFuncHelper.Create(Self, ASpline.FIntervals, @ASpline.Calculate, Step) do
|
||||||
try
|
try
|
||||||
DrawFunction(ADrawer);
|
DrawFunction(ADrawer);
|
||||||
@ -1113,16 +1111,12 @@ end;
|
|||||||
|
|
||||||
function TCubicSplineSeries.IsFewPointsVisible: Boolean;
|
function TCubicSplineSeries.IsFewPointsVisible: Boolean;
|
||||||
begin
|
begin
|
||||||
Result :=
|
Result := (csoDrawFewPoints in Options) and BadDataPen.EffVisible;
|
||||||
(csoDrawFewPoints in Options) and
|
|
||||||
BadDataPen.Visible and (BadDataPen.Style <> psClear);
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TCubicSplineSeries.IsUnorderedVisible: Boolean;
|
function TCubicSplineSeries.IsUnorderedVisible: Boolean;
|
||||||
begin
|
begin
|
||||||
Result :=
|
Result := (csoDrawUnorderedX in Options) and BadDataPen.EffVisible;
|
||||||
(csoDrawUnorderedX in Options) and
|
|
||||||
BadDataPen.Visible and (BadDataPen.Style <> psClear);
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TCubicSplineSeries.PrepareCoeffs;
|
procedure TCubicSplineSeries.PrepareCoeffs;
|
||||||
|
|||||||
@ -551,7 +551,7 @@ end;
|
|||||||
function TChart.ClipRectWithoutFrame(AZPosition: TChartDistance): TRect;
|
function TChart.ClipRectWithoutFrame(AZPosition: TChartDistance): TRect;
|
||||||
begin
|
begin
|
||||||
Result := FClipRect;
|
Result := FClipRect;
|
||||||
if (AZPosition > 0) or not Frame.Visible or (Frame.Style = psClear) then exit;
|
if (AZPosition > 0) or not Frame.EffVisible then exit;
|
||||||
Result.Left += (Frame.Width + 1) div 2;
|
Result.Left += (Frame.Width + 1) div 2;
|
||||||
Result.Top += (Frame.Width + 1) div 2;
|
Result.Top += (Frame.Width + 1) div 2;
|
||||||
Result.Bottom -= Frame.Width div 2;
|
Result.Bottom -= Frame.Width div 2;
|
||||||
|
|||||||
@ -567,7 +567,7 @@ var
|
|||||||
FItems[i].Draw(drawer, r);
|
FItems[i].Draw(drawer, r);
|
||||||
OffsetRect(r, 0, FItemSize.Y + Spacing);
|
OffsetRect(r, 0, FItemSize.Y + Spacing);
|
||||||
end;
|
end;
|
||||||
if GridHorizontal.Visible and (GridHorizontal.Style <> psClear) then begin
|
if GridHorizontal.EffVisible then begin
|
||||||
drawer.Pen := GridHorizontal;
|
drawer.Pen := GridHorizontal;
|
||||||
drawer.SetBrushParams(bsClear, clTAColor);
|
drawer.SetBrushParams(bsClear, clTAColor);
|
||||||
for i := 1 to FRowCount - 1 do begin
|
for i := 1 to FRowCount - 1 do begin
|
||||||
@ -575,7 +575,7 @@ var
|
|||||||
drawer.Line(FBounds.Left, y, FBounds.Right, y);
|
drawer.Line(FBounds.Left, y, FBounds.Right, y);
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
if GridVertical.Visible and (GridVertical.Style <> psClear) then begin
|
if GridVertical.EffVisible then begin
|
||||||
drawer.Pen := GridVertical;
|
drawer.Pen := GridVertical;
|
||||||
drawer.SetBrushParams(bsClear, clTAColor);
|
drawer.SetBrushParams(bsClear, clTAColor);
|
||||||
for i := 1 to FColCount - 1 do begin
|
for i := 1 to FColCount - 1 do begin
|
||||||
|
|||||||
@ -410,8 +410,7 @@ end;
|
|||||||
|
|
||||||
function TChartTextElement.IsMarginRequired: Boolean;
|
function TChartTextElement.IsMarginRequired: Boolean;
|
||||||
begin
|
begin
|
||||||
with GetFrame do
|
Result := (GetLabelBrush.Style <> bsClear) or GetFrame.EffVisible;
|
||||||
Result := (GetLabelBrush.Style <> bsClear) or (Style <> psClear) and Visible;
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TChartTextElement.MeasureLabel(
|
function TChartTextElement.MeasureLabel(
|
||||||
|
|||||||
@ -52,6 +52,7 @@ type
|
|||||||
constructor Create; override;
|
constructor Create; override;
|
||||||
public
|
public
|
||||||
procedure Assign(ASource: TPersistent); override;
|
procedure Assign(ASource: TPersistent); override;
|
||||||
|
function EffVisible: Boolean; inline;
|
||||||
published
|
published
|
||||||
property Visible: Boolean read FVisible write SetVisible default true;
|
property Visible: Boolean read FVisible write SetVisible default true;
|
||||||
end;
|
end;
|
||||||
@ -274,6 +275,11 @@ begin
|
|||||||
SetPropDefaults(Self, ['Color', 'Style', 'Visible']);
|
SetPropDefaults(Self, ['Color', 'Style', 'Visible']);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function TChartPen.EffVisible: Boolean;
|
||||||
|
begin
|
||||||
|
Result := Visible and (Style <> psClear);
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TChartPen.SetVisible(AValue: Boolean);
|
procedure TChartPen.SetVisible(AValue: Boolean);
|
||||||
begin
|
begin
|
||||||
FVisible := AValue;
|
FVisible := AValue;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user