mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-13 18:29:12 +02:00
TAChart: Fix broken TDBChartSource, issue #39313 (running DBGrid scrollbar).
This commit is contained in:
parent
862cedaca9
commit
41db5da688
@ -147,6 +147,7 @@ begin
|
||||
inherited AfterDraw;
|
||||
try
|
||||
if not FDataLink.Active or (FBookmark = nil) then exit;
|
||||
FDataLink.Dataset.EnableControls;
|
||||
FDataLink.DataSet.GotoBookmark(FBookmark);
|
||||
FDataLink.DataSet.FreeBookmark(FBookmark);
|
||||
finally
|
||||
@ -159,6 +160,7 @@ procedure TDbChartSource.BeforeDraw;
|
||||
begin
|
||||
inherited BeforeDraw;
|
||||
VLockedDatasets.Add(FDataLink.DataSet);
|
||||
FDataLink.Dataset.DisableControls;
|
||||
if FDataLink.Active and (FBookmark = nil) then
|
||||
FBookmark := FDataLink.DataSet.GetBookmark;
|
||||
end;
|
||||
|
@ -241,6 +241,7 @@ type
|
||||
FOnExtentChanging: TChartEvent;
|
||||
FOnExtentValidate: TChartExtentValidateEvent;
|
||||
FOnFullExtentChanged: TChartEvent;
|
||||
FBufferedFullExtent: TDoubleRect;
|
||||
FPrevFullExtent: TDoubleRect;
|
||||
FPrevLogicalExtent: TDoubleRect;
|
||||
FScale: TDoublePoint; // Coordinates transformation
|
||||
@ -254,6 +255,7 @@ type
|
||||
const AMinDataSpace: Integer);
|
||||
procedure FindComponentClass(
|
||||
AReader: TReader; const AClassName: String; var AClass: TComponentClass);
|
||||
function FullExtentBroadcastActive: Boolean;
|
||||
function GetChartHeight: Integer;
|
||||
function GetChartWidth: Integer;
|
||||
function GetHorAxis: TChartAxis;
|
||||
@ -969,6 +971,12 @@ begin
|
||||
FCurrentExtent := FLogicalExtent;
|
||||
end;
|
||||
|
||||
// Avoid calculation of the full extent when not needed
|
||||
// This extent calculation must be inside the series.BeforeDraw (--> Prepare)
|
||||
// and series.AfterDraw block (DBChartSource issue #39313)
|
||||
if FullExtentBroadcastActive then
|
||||
FBufferedFullExtent := GetFullExtent;
|
||||
|
||||
if Legend.Visible and not Legend.UseSidebar then
|
||||
Legend.Prepare(ldd, FClipRect);
|
||||
|
||||
@ -1006,12 +1014,12 @@ begin
|
||||
OnAfterDraw(Self, ADrawer);
|
||||
ADrawer.DrawingEnd;
|
||||
|
||||
tmpExtent := GetFullExtent;
|
||||
if FPrevFullExtent <> tmpExtent then begin
|
||||
if FullExtentBroadcastActive and (FPrevFullExtent <> FBufferedFullExtent) then
|
||||
begin
|
||||
FFullExtentBroadcaster.Broadcast(Self);
|
||||
if Assigned(OnFullExtentChanged) then
|
||||
OnFullExtentChanged(Self);
|
||||
FPrevFullExtent := tmpExtent;
|
||||
FPrevFullExtent := FBufferedFullExtent;
|
||||
end;
|
||||
|
||||
if FPrevLogicalExtent <> FLogicalExtent then begin
|
||||
@ -1142,6 +1150,11 @@ begin
|
||||
AClass := nil;
|
||||
end;
|
||||
|
||||
function TChart.FullExtentBroadcastActive: Boolean;
|
||||
begin
|
||||
Result := (FFullExtentBroadcaster.Count > 0) or Assigned(FOnFullExtentChanged);
|
||||
end;
|
||||
|
||||
procedure TChart.GetAllSeriesAxisLimits(AAxis: TChartAxis; out AMin, AMax: Double);
|
||||
var
|
||||
interval: TDoubleInterval;
|
||||
|
Loading…
Reference in New Issue
Block a user