YOUSEFUL / DELPHI / COMPONENTS

TAtlasRenderProc

Callback that draws onto a surface; passed to AtlasExportImage.

Type Unit Atlas.PlotSurface · Product Atlas Plot

Description

TAtlasRenderProc = reference to procedure(Surface: TAtlasPlotSurface; const Bounds: TRect);

AtlasExportImage(FileName, Width, Height, Render) creates the surface the file extension needs (a bitmap for .png and .bmp, a metafile for .emf, TAtlasSvgSurface for .svg), calls Render once with the whole image as Bounds, and writes the file through a .part file that is renamed on success. Other extensions and sizes outside 1 to 16384 raise EAtlasPlotError.

This type has no members of its own beyond those listed in its description.

Examples

Export a dashboard of two charts

Writes two charts side by side into one PNG, SVG, BMP or EMF file.

pascal
uses
  System.Types, Atlas.Plot, Atlas.PlotSurface;

procedure ExportDashboard(Sales, Costs: TAtlasPlot; const FileName: string);
begin
  AtlasExportImage(FileName, 1200, 400,
    procedure(Surface: TAtlasPlotSurface; const Bounds: TRect)
    var
      Middle: Integer;
    begin
      Middle := Bounds.Left + Bounds.Width div 2;
      Sales.Render(Surface, Rect(Bounds.Left, Bounds.Top, Middle, Bounds.Bottom));
      Costs.Render(Surface, Rect(Middle, Bounds.Top, Bounds.Right, Bounds.Bottom));
    end);
end;

TAtlasPlotSurface · TAtlasPlot

Also in Atlas Plot

TAtlasPlot