When the chart editor demo is used for projects using also TChartLiveView (
https://wiki.freepascal.org/TAChart_documentation#Live_View), the following patch is necessary for the procedure FormCloseQuery in ceAxisDlg.pas:
procedure TChartAxisEditor.FormCloseQuery(Sender: TObject; var CanClose: boolean);
begin
if not CanClose then exit;
if not FOKClicked then begin
RestoreAxisParams;
GetChart.Invalidate;
end
else
// when LiveView is used LiveView can have set the min/max values of axis
// because new data points might have been set while the axis dialog was open
// therefore check if the min/max set in the dialog are the ones in the axis
// and if not set them
begin
if FAxis.Range.Max <> FAxisFrame.seMaximum.Value then
FAxis.Range.Max := FAxisFrame.seMaximum.Value;
if FAxis.Range.Min <> FAxisFrame.seMinimum.Value then
FAxis.Range.Min := FAxisFrame.seMinimum.Value;
end;
end;
The problem is that the chart editor demo dialog applies the changes made in the dialog immediately. This is per se a good idea since the user sees the changes immediately.
However one needs some time to make all changes in the dialog and meanwhile new data points can have arrived so that LiveView changes the Max before the dialog is closed.
Therefore one must assure that really the values from the dialog are used when the dialog is closed.
------------
Another info: When LiveView is used one must in procedure TMainForm.EditAxis (in ceMain.pas) inform LiveView about the changes made via the chart editor dialog by using the LiveView procedure StoreAxisRange. So TMainForm.EditAxis becomes
procedure TMainForm.EditAxis(AAxis: TChartAxis; APage: TChartAxisEditorPage);
var
F: TChartAxisEditor;
begin
if cbUseAllInOneDialog.Checked then
EditChartAxis(AAxis, APage)
else
begin
F := TChartAxisEditor.Create(nil);
try
F.Prepare(AAxis, 'Edit chart axis "%s"');
F.Page := APage;
F.ShowModal;
// update the axis settings for the LiveView
ChartLiveView.StoreAxisRange(AAxis);
finally
F.Free;
end;
end;
end;