HotXLS Docs

TXLSXChartLayout class

TXLSXChartLayout stores a field-preserving manual layout for plot areas, chart or axis titles and legends

Declaration

type
  TXLSXChartLayoutTarget = (xlsxChartLayoutOuter, xlsxChartLayoutInner);
  TXLSXChartLayoutMode = (xlsxChartLayoutFactor, xlsxChartLayoutEdge);

  TXLSXChartLayout = class
    property Enabled: Boolean;
    property HasTarget: Boolean;
    property HasXMode, HasYMode, HasWidthMode, HasHeightMode: Boolean;
    property HasX, HasY, HasWidth, HasHeight: Boolean;
    property Target: TXLSXChartLayoutTarget;
    property XMode, YMode, WidthMode, HeightMode: TXLSXChartLayoutMode;
    property X, Y, Width, Height: Double;
    procedure ClearTarget;
    procedure ClearXMode;
    procedure ClearYMode;
    procedure ClearWidthMode;
    procedure ClearHeightMode;
    procedure ClearX;
    procedure ClearY;
    procedure ClearWidth;
    procedure ClearHeight;
    procedure SetPositionAndSize(AX, AY, AWidth, AHeight: Double);
    procedure Assign(Source: TXLSXChartLayout);
    procedure Clear;
  end;

Coordinate model

X, Y, Width and Height are normalized against the chart rectangle Edge X and Y are left and top coordinates, edge width and height are right and bottom coordinates, factor X and Y offset the automatic position, and factor width and height are chart-relative sizes
The model retains each field and mode independently Loaded omissions stay omitted and invalid numeric tokens survive an unchanged save while rendering falls back to automatic geometry
Title layouts may contain only X and Y and retain the automatically measured size Plot-area and legend layouts require all four coordinates
SetPositionAndSize assigns all four values, marks their modes present and enables the layout in one call Individual coordinate setters also enable the layout

Modes and target

xlsxChartLayoutEdgePosition from the chart edge, used by default for X and Y
xlsxChartLayoutFactorSize or offset factor, used by default for width and height
TargetInner or outer plot rectangle and meaningful only for PlotAreaLayout

Resolution and conversion

TXLSXChartLayoutResolver resolves title, legend, inner and outer plot-area, and axis-title rectangles once for pagination, SVG, PDF, image, preview, print, viewer and HTML output Invalid or incomplete geometry keeps the automatic rectangle, while a valid out-of-bounds rectangle moves to the closest in-chart position without changing size
ODF conversion maps resolved geometry to absolute chart distances Title and legend use svg:x and svg:y, while the plot area also uses svg:width and svg:height A manual ODF legend omits chart:legend-position because that attribute overrides absolute coordinates

Example

Chart.PlotAreaLayout.Target := xlsxChartLayoutInner;
Chart.PlotAreaLayout.SetPositionAndSize(0.12, 0.18, 0.72, 0.64);
Chart.TitleLayout.SetPositionAndSize(0.1, 0.02, 0.6, 0.12);
Chart.LegendLayout.SetPositionAndSize(0.2, 0.84, 0.6, 0.1);

See also