NiceChart: Activate clipping at the chart box boundaries.

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@8862 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
wp_xxyyzz
2023-06-27 21:04:18 +00:00
parent de8eb2802b
commit 25e81e6296

View File

@ -1471,37 +1471,49 @@ begin
AutoColors(ACanvas, Index, sr.FKind = skBar); AutoColors(ACanvas, Index, sr.FKind = skBar);
with ACanvas do with ACanvas do
begin begin
ClipRect := RcChart;
if (sr.FKind = skBar) then if (sr.FKind = skBar) then
begin begin
Pen.Width := 1; Clipping := true;
for x := 0 to Sr.Values.Count-1 do try
begin Pen.Width := 1;
P := PXYInfo(Sr.Values[x]);
Rectangle(P^.Rc);
end;
end else
begin
if (sr.FKind = skLine) then
begin
Pen.Width := sr.LineWidth;
for x := 0 to Sr.Values.Count-1 do for x := 0 to Sr.Values.Count-1 do
begin begin
P := PXYInfo(Sr.Values[x]); P := PXYInfo(Sr.Values[x]);
if (x = 0) Rectangle(P^.Rc);
then MoveTo(P^.Px, P^.Py)
else LineTo(P^.Px, P^.Py);
end; end;
end else finally
if (sr.FKind = skSmooth) then Clipping := false;
begin end;
Pen.Width := sr.LineWidth; end else
sr.Spline.Draw(ACanvas); begin
Clipping := true;
try
if (sr.FKind = skLine) then
begin
Pen.Width := sr.LineWidth;
for x := 0 to Sr.Values.Count-1 do
begin
P := PXYInfo(Sr.Values[x]);
if (x = 0)
then MoveTo(P^.Px, P^.Py)
else LineTo(P^.Px, P^.Py);
end;
end else
if (sr.FKind = skSmooth) then
begin
Pen.Width := sr.LineWidth;
sr.Spline.Draw(ACanvas);
end;
finally
Clipping := false;
end; end;
Pen.Width := 1; Pen.Width := 1;
for x := 0 to Sr.Values.Count-1 do for x := 0 to Sr.Values.Count-1 do
begin begin
P := PXYInfo(Sr.Values[x]); P := PXYInfo(Sr.Values[x]);
Marker(ACanvas, P^.Px, P^.Py, MarkSize); if PtInRect(RcChart, Point(P^.Px, P^.Py)) then
Marker(ACanvas, P^.Px, P^.Py, MarkSize);
end; end;
end; end;
if FShowLegend then if FShowLegend then