HotXLS Docs

TXLSXChartLayout class

TXLSXChartLayout stores a complete normalized 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 Target: TXLSXChartLayoutTarget;
    property XMode, YMode, WidthMode, HeightMode: TXLSXChartLayoutMode;
    property X, Y, Width, Height: Double;
    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 Width and height are constrained to 0 through 1, while factor-based X and Y may use -1 through 1
SetPositionAndSize assigns all four values and enables the layout in one call This satisfies Excel's requirement that manual coordinates be emitted as a complete group

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

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