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 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 Width and height are constrained to 0 through 1, while factor-based X and Y may use -1 through 1
Model zachowuje każde pole i każdy tryb niezależnie — braki zaobserwowane w pliku pozostają brakami, a nieprawidłowe tokeny liczbowe przetrwają zapis bez zmian, podczas gdy renderowanie wraca do automatycznej geometrii
Układy tytułów mogą zawierać tylko X i Y i zachowują automatycznie zmierzony rozmiar; układy obszaru wykresu i legendy wymagają wszystkich czterech współrzędnych
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

Wyznaczanie i konwersja

TXLSXChartLayoutResolver wyznacza jednorazowo prostokąty tytułu, legendy, wewnętrznego i zewnętrznego obszaru wykresu oraz tytułów osi na potrzeby paginacji, SVG, PDF, obrazów, podglądu, wydruku, przeglądarki i wyjścia HTML. Nieprawidłowa lub niekompletna geometria zachowuje prostokąt automatyczny, natomiast poprawny prostokąt znajdujący się poza wykresem trafia w najbliższą pozycję wewnątrz wykresu bez zmiany rozmiaru
Konwersja do ODF mapuje wyznaczoną geometrię na bezwzględne odległości na wykresie. Tytuł i legenda używają svg:x i svg:y, a obszar wykresu dodatkowo svg:width i svg:height. Ręcznie ustawiona legenda ODF pomija chart:legend-position, ponieważ ten atrybut nadpisuje współrzędne bezwzględne

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