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