YOUSEFUL / DELPHI / COMPONENTS
EAtlasPlotError
Raised by Atlas Plot for invalid values, ranges, sizes and formats; the chart is left unchanged.
Description
Every mutation in Atlas Plot validates before it changes anything and raises this exception when the input is invalid, so a rejected call leaves the chart, series and axes as they were. Typical causes: a NaN, infinite or larger than 1E100 value; a negative pie value; a manual range or zoom window whose minimum is not below its maximum; a logarithmic axis with a minimum of zero or less; a logarithmic date/time axis; an image size outside 1 to 16384; an unsupported export extension; malformed CSV; statistics of a series without values.
The unit also declares procedure CheckPlotValue(const Value: Double);, which raises EAtlasPlotError exactly when the chart would reject Value, so you can validate input yourself first.
File exports can also fail with the usual stream or OS exceptions (missing folder, locked file); those are not converted.
This type has no members of its own beyond those listed in its description.
Examples
Reject bad input without losing data
Adds a reading and reports a rejected one; the series is unchanged after a failure.
uses
System.SysUtils, Vcl.Dialogs, Atlas.PlotAxis, Atlas.PlotSeries;
procedure AddReading(Series: TAtlasPlotSeries; const X, Y: Double);
begin
try
Series.Add(X, Y);
except
on E: EAtlasPlotError do
ShowMessage('Reading rejected: ' + E.Message);
end;
end;
function IsPlottable(const Value: Double): Boolean;
begin
try
CheckPlotValue(Value);
Result := True;
except
on EAtlasPlotError do
Result := False;
end;
end;
Related
TAtlasPlot · TAtlasPlotSeries · TAtlasPlotAxis