Skip to main content

Module chart

Module chart 

Source
Expand description

Everything from the chart crate — embedded charts, shared by every format. Always available, same reasoning as crate::drawing.

Structs§

Area3DChart
A 3D area chart (<c:area3DChart>, CT_Area3DChart) — reuses EG_AreaChartShared exactly like AreaChart (same AreaSeries, grouping: Option<LineGrouping> genuinely optional here too). Like Bar3DChart, the third (series) axis id is genuinely optional (axId minOccurs="2" maxOccurs="3").
AreaChart
An area chart (<c:areaChart>, CT_AreaChart) — like BarChart/ LineChart, always paired with exactly two axes.
AreaSeries
An area chart series (<c:ser> inside <c:areaChart>, CT_AreaSer) — like BarSeries, but with no marker (area charts have none).
Bar3DChart
A 3D bar/column chart (<c:bar3DChart>, CT_Bar3DChart) — reuses EG_BarChartShared exactly like BarChart (same BarSeries, direction/grouping/vary_colors/series), plus depth-specific fields. Unlike BarChart, a third axis id (the series/depth axis) is genuinely optional here (axId minOccurs="2" maxOccurs="3"), modeled as series_axis_id: Option<u32> — this is cardinality, not a schema default being masked (an axis id has no default value at all).
BarChart
A bar/column chart (<c:barChart>, CT_BarChart) — always paired with exactly two axes (axId minOccurs="2" maxOccurs="2", hence the plain tuple rather than Option/Vec), one CategoryAxis and one ValueAxis.
BarSeries
A bar/column chart series (<c:ser> inside <c:barChart>, CT_BarSer).
CategoryAxis
The category axis (<c:catAx>, CT_CatAx) — paired with a ValueAxis for bar/line charts. Pie/Pie3D/Doughnut charts have no axes at all: confirmed structurally against the schema, CT_PieChart’s EG_PieChartShared group has no axId element whatsoever, unlike CT_BarChart/CT_LineChart which each require exactly two (axId minOccurs="2" maxOccurs="2").
Chart
The chart itself (<c:chart>, CT_Chart) — title, the required plot area, legend, a couple of chart-wide display flags, and the 3D view/wall dressing used by any 3D chart type in PlotArea::charts.
ChartSpace
The chart part’s root element (<c:chartSpace>, CT_ChartSpace) — the whole content of a chart XML part (e.g. xl/charts/chart1.xml). Unlike drawing’s fragment-only functions, this crate’s reader/writer for ChartSpace produce/consume the entire part (XML declaration and root element included) — <c:chartSpace> is always the same element regardless of host, unlike <a:spPr>, which is wrapped differently by each host (see lib.rs’s doc comment).
DoughnutChart
A doughnut chart (<c:doughnutChart>, CT_DoughnutChart) — reuses EG_PieChartShared exactly like PieChart (the same PieSeries, no new series type needed), plus a hole size. Structurally axis-less, same as PieChart (confirmed the same way: EG_PieChartShared has no axId).
Legend
The chart’s legend (<c:legend>, CT_Legend).
Line3DChart
A 3D line chart (<c:line3DChart>, CT_Line3DChart) — reuses EG_LineChartShared exactly like LineChart (same LineSeries, grouping non-Option for the same reason as LineChart::grouping). Unlike Bar3DChart/Area3DChart, the third (series) axis id is strictly required here (axId minOccurs="3" maxOccurs="3", not 2.3), so all three axis ids are plain u32, not Option.
LineChart
A line chart (<c:lineChart>, CT_LineChart) — like BarChart, always paired with exactly two axes.
LineSeries
A line chart series (<c:ser> inside <c:lineChart>, CT_LineSer).
Marker
A line/scatter/radar series’ marker (<c:marker>, CT_Marker).
NumericData
A numeric cache (CT_NumData) — either the snapshot of a cell range’s values (inside a NumericDataSource::Reference) or the literal values themselves (inside a NumericDataSource::Literal).
NumericPoint
One point in a numeric cache (<c:pt idx=".." formatCode="..">, CT_NumVal). Kept as the raw text <c:v> holds (the schema types it as s:ST_Xstring, an arbitrary string, not literally a number) rather than parsed into f64 — the same “no floating-point rounding drift, exact round-trip” posture this workspace already applies to unit-suffixed fields elsewhere.
Pie3DChart
A 3D pie chart (<c:pie3DChart>, CT_Pie3DChart) — reuses EG_PieChartShared exactly like PieChart/DoughnutChart (same PieSeries), with no fields of its own at all — confirmed against the schema: CT_Pie3DChart is just the shared group plus extLst, unlike DoughnutChart which adds holeSize/firstSliceAng. Structurally axis-less, like every other pie-family chart.
PieChart
A pie chart (<c:pieChart>, CT_PieChart) — structurally axis-less (see CategoryAxis’s doc comment for the schema confirmation), unlike BarChart/LineChart.
PieSeries
A pie chart series (<c:ser> inside <c:pieChart>, CT_PieSer) — structurally simpler than BarSeries/LineSeries: no marker (pie slices have none), and the chart itself has no axes at all (see PieChart’s doc comment).
PlotArea
The chart’s plot area (<c:plotArea>, CT_PlotArea) — one or more chart-type entries (the schema allows overlaying series of different types on the same axes, e.g. a bar chart with a line chart drawn over it), zero or more axes, and optional shape formatting.
ScatterChart
A scatter chart (<c:scatterChart>, CT_ScatterChart) — like other chart types, paired with exactly two axes (both value axes in practice, named x_axis_id/y_axis_id here rather than category_axis_id/ value_axis_id since a scatter chart has no category axis at all).
ScatterSeries
A scatter chart series (<c:ser> inside <c:scatterChart>, CT_ScatterSer) — uses xVal/yVal instead of cat/val: a scatter chart has no category axis, both axes are numeric value axes.
StringData
A string cache (CT_StrData).
StringPoint
One point in a string cache (<c:pt idx="..">, CT_StrVal).
Surface
A 3D chart’s wall/floor dressing (<c:floor>/<c:sideWall>/ <c:backWall>, all CT_Surface) — the same type reused for all three, exactly as the schema does.
Surface3DChart
A 3D surface chart (<c:surface3DChart>, CT_Surface3DChart, EG_SurfaceChartShared). Like Line3DChart, all three axis ids are strictly required here (axId minOccurs="3" maxOccurs="3") — unlike Bar3DChart/Area3DChart’s genuinely optional third axis.
SurfaceSeries
A surface chart series (<c:ser> inside <c:surface3DChart>/ <c:surfaceChart>, CT_SurfaceSer) — unlike every other series type in this crate, has no spPr and no marker (confirmed against the schema: a surface’s banding is formatted globally via bandFmts/the Surface wall dressing, not per series).
Title
A chart or axis title (<c:title>, CT_Title) — reused identically by CT_Chart’s own title and by each axis’s title (EG_AxShared::title).
ValueAxis
The value axis (<c:valAx>, CT_ValAx) — see CategoryAxis’s doc comment for the same not-modeled list (tick marks, crosses/crossesAt, numFmt, spPr/txPr); additionally not modeled here: majorUnit/ minorUnit (fixed gridline spacing), dispUnits (axis display-unit scaling, e.g. “in thousands”).
View3D
The chart’s 3D view settings (<c:view3D>, CT_View3D) — camera rotation/perspective for any 3D chart type. Every field is genuinely optional at the schema level (minOccurs="0" on each), so there is no LineChart::grouping-style round-tripping risk here: an absent element simply isn’t written, never falling back to a default value the reader could mistake for an explicit Some.
Writer
Writes a sequence of generic XML events to an underlying std::io::Write.

Enums§

Axis
One axis entry in the plot area’s axis choice (CT_PlotArea’s second unbounded choice) — only category/value modeled; serAx (series axis, used by surface charts) and dateAx (date axis) are deferred.
AxisDataSource
A category axis data source (CT_AxDataSource) — the choice between numeric categories (e.g. dates or numbers used as categories) and string categories (the common case, e.g. month names). multiLvlStrRef (multi-level, hierarchical categories) is not modeled.
AxisPosition
ST_AxPos — which side of the plot area an axis is drawn on.
Bar3DShape
ST_Shape — the physical shape used for each bar in a 3D bar/column chart (<c:shape> inside CT_Bar3DChart). The whole <c:shape> element is optional (minOccurs="0", attribute default "box"), so modeled Option<Bar3DShape> — an absent element is simply omitted by the writer, never a bare fallback value.
BarDirection
ST_BarDir — bars are drawn horizontally (Bar) or vertically (Column, the far more common case and the schema’s own default).
BarGrouping
ST_BarGrouping.
ChartType
One chart-type entry in the plot area’s chart-type choice (CT_PlotArea’s first unbounded choice) — models bar/line/pie, doughnut/area/scatter, and their 3D counterparts plus a 3D-only surface chart; every other ECMA-376 chart type is explicitly deferred.
CrossBetween
ST_CrossBetween — value axis only: whether the category axis crosses the value axis between categories or at the category’s midpoint.
DisplayBlanksAs
ST_DispBlanksAs.
Error
Errors that can occur while reading or writing chart XML.
LegendPosition
ST_LegendPos.
LineGrouping
ST_Grouping — shared by line/area charts (bar charts use the larger BarGrouping, which additionally has clustered).
MarkerSymbol
ST_MarkerStyle — the shape drawn at each data point of a line/scatter/ radar series.
NumericDataSource
A numeric data source (CT_NumDataSource‘s numRef/numLit choice) — values that are always numbers, e.g. a series’ <c:val>.
ScatterStyle
ST_ScatterStyle — required by the schema (minOccurs="1", default "marker"), so modeled as a plain, non-Option field with #[default] from the start, avoiding the kind of round-tripping hazard a schema-required element modeled as Option would create.
SeriesTitle
A series’ name (CT_SerTx) — either a cell reference (with an optional single cached string — the schema’s own strCache is a full StringData list, but a series title only ever uses its first point in practice, so this simplifies it to Option<String>) or a literal string with no cell reference at all.
StringDataSource
A string data source (CT_StrRef/CT_StrData choice, used standalone for e.g. a scatter/bubble series — bar/line/pie series instead use AxisDataSource for categories, see below).
TitleText
A title’s text content (CT_Tx) — either rich text (reusing drawing::TextBody, the common case for a chart or axis title) or a cell reference (<c:strRef>, valid per schema though rarely used for titles in practice).

Functions§

read_chart_space
Reads a whole chart part’s XML text and returns its ChartSpace.
write_chart
Writes <c:chart>..</c:chart> (CT_Chart).
write_chart_space
Writes a whole chart part: the XML declaration, then <c:chartSpace> and everything inside it.
write_legend
Writes <c:legend>..</c:legend> (CT_Legend).
write_plot_area
Writes <c:plotArea>..</c:plotArea> (CT_PlotArea).
write_title
Writes <c:title>..</c:title> (CT_Title) — reused for both the chart’s own title and an axis’s title.

Type Aliases§

Result
A Result alias using [Error] as the error type.