HotXLS Docs

Portable combined charts

Author and edit supported typed XLSX chart models, save them, reopen them and capture their represented appearance into an immutable portable scene by way of the existing public workbook APIs

The supported profile combines Column, Line and Area plot groups on primary or secondary Cartesian axes, allows several ordinary, stacked or percentage Area series, and renders multiple Doughnut series as concentric rings

A separate primary Column and secondary straight Scatter profile keeps independent category and numeric X domains, differing point counts, three explicit numeric scales and four distinct axis owners

Use the portable headless output pipeline to hand a captured scene over and render it with native Cairo; merely loading a chart or keeping hold of its caches does not establish portable rendering support

The extended combined Cartesian role profile adds finite primary/secondary vertical, horizontal and numeric pairs with several series, explicit crossing baselines and ownership rooted in the saved source

Represented native ChartML projection

Ordinary native Style 2 Column, Line, Area and Doughnut profiles can be opened, captured, saved, edited and reopened through the public Workbook path whilst the source keeps its original ChartML and opaque metadata

The bounded projection compares the complete represented appearance before recording a detached scene; it preserves axis identity, crossing references, plot-group order and series order, and turns away unmatched active nodes or attributes

Finite equivalences include the recognised Style 102 fallback to Style 2, effective schema defaults, empty effects and equal explicit Latin, East Asian and complex-script typefaces; these rules do not admit arbitrary theme or style changes

TXLSXChartAxis.CrossBetween retains the value-axis category placement setting through import, edits, assignment and serialisation: between places categories in bands, whilst midCat places the first and last categories at the plot endpoints

TXLSXChart.DefaultTextStyle supplies the represented chart-space text defaults through the normal ownership and mutation guards; ChartBorderVisible distinguishes a hidden chart outline from an unspecified border colour and can restore a hidden outline without discarding unrelated metadata

The represented combined plan draws category tick marks, honours admitted zero/minimum/maximum crossings and retains an invisible secondary category axis at its stored position

Native projected Style 2 axis, tick and gridline RGB values follow the independently observed bounded theme profile; custom themes and unrepresented font effects sit outside that profile

Plot groups and independent axes

TXLSXChart.AddPlotGroup selects the chart family and xlsxAxisPrimary or xlsxAxisSecondary; each group owns its series, category spacing and drawing order

ValueAxis and SecondaryValueAxis collect separate value domains, so a secondary line with values in the thousands does not alter the primary columns' scale; declared minimum and maximum endpoints are applied independently, including when just one endpoint is explicit

For Column groups, GapWidth expresses the inter-cluster gap as a percentage of a single column's width, rather than the width of the whole series cluster

Automatic tick spacing is bounded and deterministic; it does not reproduce every automatic-scale heuristic Excel applies

ZOrder controls group paint order with stable ordering for equal values; area stacking and percentage denominators stay local to their own group

The example explicitly declares straight lines, no markers and maximum crossings for the secondary axes; the represented secondary value axis appears on the right and its category axis along the top

uses
  SysUtils, Classes, lxHandleX, lxPortableRender,
  lxPortableWorkbookCapture;

procedure AddCombinedChart(Workbook: TXLSXWorkbook);
var
  Chart: TXLSXChart;
  Group: TXLSXChartPlotGroup;
  Series: TXLSXChartSeries;

  function AddCachedSeries(AGroup: TXLSXChartPlotGroup;
    const Name, RGB: WideString;
    const Values: array of WideString): TXLSXChartSeries;
  var
    I: Integer;
  begin
    Result := AGroup.AddSeries(Name, '', '');
    Result.SolidFillHex := RGB;
    Result.SolidFillSet := True;
    Result.ValueCache.Kind := xlsxChartCacheNumber;
    Result.CategoryCache.Kind := xlsxChartCacheString;
    for I := 0 to High(Values) do
    begin
      Result.ValueCache.Add(I, Values[I]);
      Result.CategoryCache.Add(I, WideString(Char(Ord('A') + I)));
    end;
  end;

begin
  Chart := TXLSXChart.Create;
  try
    Chart.ChartType := xlsxChartColumn;
    AddCachedSeries(Chart.PlotGroups[0], 'Units', 'CC3333',
      ['10', '20', '30']);
    AddCachedSeries(Chart.PlotGroups[0], 'Targets', '339933',
      ['20', '15', '25']);
    Chart.ValueAxis.MinValue := 0;
    Chart.ValueAxis.MaxValue := 40;
    Chart.ValueAxis.MajorUnit := 10;

    Group := Chart.AddPlotGroup(xlsxChartLine, xlsxAxisSecondary);
    Group.ZOrder := 1;
    Series := AddCachedSeries(Group, 'Revenue', '3366CC',
      ['1000', '2000', '1500']);
    Series.LineVisible := True;
    Series.LineColorRGB := $3366CC;
    Series.MarkerSymbol := xlsxMarkerNone;
    Series.MarkerSet := True;
    Series.Smooth := False;
    Series.SmoothSet := True;
    Chart.SecondaryValueAxis.MinValue := 0;
    Chart.SecondaryValueAxis.MaxValue := 2500;
    Chart.SecondaryValueAxis.MajorUnit := 500;
    Chart.SecondaryCategoryAxis.Crosses := xlsxCrossesMax;
    Chart.SecondaryCategoryAxis.CrossesSet := True;
    Chart.SecondaryValueAxis.Crosses := xlsxCrossesMax;
    Chart.SecondaryValueAxis.CrossesSet := True;

    // AddExisting copies the chart into the worksheet
    Workbook.Sheets[1].Charts.AddExisting(Chart);
  finally
    Chart.Free;
  end;
end;

Sheets[1] selects the first worksheet, whilst Charts[0], PlotGroups[0] and Series[0] select the first item of their respective chart collections

SolidFillSet declares the stored fill as explicit; a fill-only series follows the existing hidden-line convention, so the line series also switches its connecting line on explicitly

Save, reopen, edit and capture

The following procedure uses AddCombinedChart above, saves the authored workbook, reopens and edits the actual typed chart, saves that edit, then captures the reopened result via CaptureXLSPortableRenderSnapshot

This example uses the default Windows geometry service; native Linux and macOS capture take the explicit geometry overload with a provider for the workbook's current view generation, as covered under native workbook capture

procedure SaveAndCaptureCombined(const AuthoredFile, EditedFile: WideString;
  Destination: TStream);
var
  Workbook: TXLSXWorkbook;
  Owner: IXLSXWorkbookOwner;
  Snapshot: IXLSPortableRenderSnapshot;
  Limits: TXLSPortableRenderLimits;
begin
  Workbook := TXLSXWorkbook.Create;
  Owner := Workbook;
  try
    Workbook.Sheets.Add('Data');
    AddCombinedChart(Workbook);
    if Workbook.SaveAs(AuthoredFile) <> 1 then
      raise Exception.Create('Cannot save the authored workbook');
    if Workbook.Open(AuthoredFile) <> 1 then
      raise Exception.Create('Cannot reopen the authored workbook');

    Workbook.Sheets[1].Charts[0].PlotGroups[1].Series[0].
      ValueCache[0].Value := '1750';
    Workbook.Sheets[1].Charts[0].SecondaryValueAxis.MaxValue := 3000;
    if Workbook.SaveAs(EditedFile) <> 1 then
      raise Exception.Create('Cannot save the edited workbook');
    if Workbook.Open(EditedFile) <> 1 then
      raise Exception.Create('Cannot reopen the edited workbook');

    Limits := XLSDefaultPortableRenderLimits;
    Snapshot := CaptureXLSPortableRenderSnapshot(Owner,
      1, 1, 1, 20, 12, Limits);
    SaveXLSPortableRenderSnapshot(Snapshot, Destination, Limits);
  finally
    Snapshot := nil;
    Owner := nil;
  end;
end;

The interface owner keeps the workbook alive during capture; the resulting snapshot owns its represented scene and can outlive that owner, whilst the caller keeps ownership of Destination

Capture draws on complete stored caches without calculating worksheet formulas; supply finite values with contiguous zero-based value-cache indexes and supported category labels or local one-dimensional A1 references

The existing explicit-geometry overload is declared in lxPortableWorkbookCapture; its geometry interface is declared in lxRenderGeometry

function CaptureXLSPortableRenderSnapshot(const Owner: IXLSXWorkbookOwner;
  SheetIndex, Row1, Col1, Row2, Col2: Integer;
  const Limits: TXLSPortableRenderLimits; const Geometry: IXLSRenderGeometry):
  IXLSPortableRenderSnapshot; overload;

Multiple Area series

Set the group's ChartType to xlsxChartArea and use its existing BarGrouping property: xlsxBarGroupClustered selects ordinary overlapping areas, xlsxBarGroupStacked selects stacked areas, and xlsxBarGroupPercentStacked selects percentage areas

Ordinary areas each close to the zero baseline; stacked areas use signed cumulative boundaries in series order, so the next band's lower boundary is the cumulative boundary before it

For percentage areas, each category's denominator is the sum of the absolute contributions in that group; signed contributions are then accumulated algebraically, and a zero denominator yields zero boundaries for every series in that category

For example, contributions 10 and -30 have denominator 40 and cumulative boundaries 0.25 and -0.50; positive and negative contributions are never accumulated into separate stacks

Pure Area charts place the first and last categories at the plot endpoints by default; axes shared with Column or Line groups use category bands, whilst explicit Appearance.UseAxisTickControls selects the existing CategoryBetween control

The existing portable area-opacity option still applies; matching every native raster colour or alpha blend sits outside this profile

Concentric Doughnut rings

A supported Doughnut group draws its first series as the inner ring and the later series outward, with equal radial widths between the declared hole and outer radius

HoleSize and FirstSliceAng keep their declared meanings, zero-valued slices are omitted, and a zero-total ring rejects before a scene is published

Each ring is represented by its own slices; drawing an outer ring never erases inner rings already recorded with a background ellipse

For the admitted Style 2 automatic Doughnut profile without a title or legend, the plot circle uses the centred chart canvas with 11-point margins, matching native observations across five chart sizes and two font sizes

The public capture selects the represented full-circle radius; explicit lower-level appearance ratios and geometry overrides keep their existing precedence, and unsupported manual layouts keep their explicit boundary

Empty, nonfinite or too-small circles reject before a partial scene is published; complete outer bounds, centre, ring holes and layer order are checked independently

Auto and explicit markers

The qualified combined Line profile resolves automatic marker shapes by series index across the whole chart, working through the repeating cycle Diamond, Square, Triangle, X, Star, Circle, Plus, Dot and Dash

Column and Area series still occupy global series indexes; a line following two column series therefore starts at Triangle rather than restarting the cycle at the first line group

MarkerSet = False selects automatic ownership; MarkerSet = True with xlsxMarkerAuto requests the automatic shape explicitly, whilst xlsxMarkerNone explicitly suppresses markers

The nine explicit symbols are Circle, Dash, Diamond, Dot, Plus, Square, Star, Triangle and X; Dot and Dash keep different widths, and explicit fill and border colours use MarkerFillSet and MarkerBorderSet so RGB zero can mean explicit black

Declare MarkerSet = True when choosing an explicit MarkerSize from 2 through 72; assigning a positive size whilst MarkerSet = False neither serialises an explicit marker size nor overrides automatic geometry

Unrepresented custom-theme automatic colour selection sits outside the independently qualified profiles; use explicit represented RGB settings when that distinction matters

Complete edge-mode manual plot rectangles

Version 2.384.403 admits complete non-negative manual plot rectangles whose position and size modes are both xlsxChartLayoutEdge via the existing portable chart capture profile

An edge-mode width names the normalised right coordinate and an edge-mode height names the normalised bottom coordinate; they are not added to the left and top positions

For instance, left 0.35, top 0.25, right 0.85 and bottom 0.9 describe the same rectangle as factor-mode width 0.5 and height 0.65

Complete edge rectangles need right greater than left and bottom greater than top, with the existing finite scalar and unit-range limits; factor and mixed-mode admission limits stay unchanged

The qualified public capture keeps the same represented primitives through checked XLSX saving, releasing the source, normal reopening, repeated saving and a corrected retry once a reversed edge is refused

Workbook mutation generations may move on during editing and reload; the qualification compares complete snapshot content whilst normalising only the serialized eight-byte generation field

This repairs admission for a finite existing manual plot profile without changing the layout solver or native placement; title and legend geometry, broader manual layouts, native pixel parity and the remaining original B7 requirements stay separate

Automatic Cartesian plot bounds

Version 2.384.379 resolves absolute inside plot bounds automatically for ordinary public CaptureXLSPortableRenderSnapshot and CaptureXLSPortableViewRenderSnapshot calls for represented Style 2 vertical Column (xlsxChartColumn), Line (xlsxChartLine) and multi-Area (xlsxChartArea) charts when Title = '', ShowLegend = False, PlotAreaLayout.Enabled = False, caller OverridePlotInnerRectangle = False and no trendlines or error bars are attached

IXLSAutomaticChartCapturePreparation prepares and validates all eligible worksheet charts on the read-only view ahead of the first internal or caller geometry getter, charging aggregate byte, character, item and lookup-step budgets up front and letting go of transient clones once capture finishes; the bracket is expressed by its two methods, PrepareAutomaticChartCapture(SheetIndex, Limits) for one sheet and ReleaseAutomaticChartCapture when capture finishes

Validation of non-extended combined charts admits an invisible secondary category axis (delete="1", Visible = False) when Excel writes crosses="autoZero" or crosses="max" on a normal save, whilst still requiring crosses="max" whenever a secondary category axis is visible

The shared Cartesian solver derives one plot rectangle from the chart frame (Outer.Left = X + 7, Outer.Top = Y + 7, Outer.Right = X + Width - 15, Outer.Bottom = Y + Height - 15), 16x subpixel-scaled text measurements (Font.Size <= 256), measured font line heights (Max(0, LabelHeight * 0.74 - 4) on visible vertical value axes, Max(0, CategoryHeight * 0.50 - 4) on external horizontal category axes and top half-height guard Y + LabelHeight / 2 + 1), endpoint category half-width overhang when CategoryBetween = False and internal zero-crossing label placement without reserving a spare external bottom band

Explicit caller plot overrides and the configured CreateReadOnlyViewWithChartAppearance declaration route keep their existing precedence and byte-identical output

Bounds and remaining profiles

The profile accepts at most 16 plot groups, 256 series in total and 100,000 dense points per series, subject to the caller's stricter scene-item, byte and text limits; represented cache and configuration values are copied into an owned snapshot before recording

Unsupported input raises EXLSPortableRender before a partial scene is published; the new Cartesian profile takes straight lines and keeps the existing refusal of smoothing the recorder does not implement

Preserved native ChartML still passes the exact represented-appearance gate; arbitrary native imports that fail that gate stay rejected, and stripping preserved XML is not a supported way round an unrepresented appearance

Classic combination expansion, extra secondary Scatter families or Bar combinations, unrepresented date or logarithmic axes, reversed axes, richer crossing and manual-layout geometry, combined annotation profiles beyond the finite detached declared-plot recorder, annotation capture beyond the finite configured workbook view, and arbitrary native style reproduction all remain separate work

Representative Windows public author/edit/save/reopen checks, independent package and scene checks, actual Linux Cairo SVG/PNG output and four native package object-model checks qualify these bounded paths; the checks do not establish complete image-layer equivalence or completion of every combined-chart profile

The retained native input set contains thirteen supported ordinary combination, Area and Doughnut workbooks; the multi-series Pie and Radar observations keep their earlier refusal

Representative public lifecycle, preserved metadata, owned-property and malformed-input checks accompany actual Linux Cairo output; circular absolute geometry and normalised coloured topology are compared independently against native output

Version 2.384.379 qualifies automatic Cartesian plot bounds within 0.5 points on each inside edge and 1.0 native pixel on same-frame axis and gridline centrelines across seven discovery and two held-out specimens; manual layouts, titled or legend-bearing automatic layouts, complete raster image equality, arbitrary native styles and finishing every original B7 requirement all remain separate