Expand description
Everything from the chart crate — embedded charts, shared by every format. Always
available, same reasoning as crate::drawing.
Structs§
- Area3D
Chart - A 3D area chart (
<c:area3DChart>,CT_Area3DChart) — reusesEG_AreaChartSharedexactly likeAreaChart(sameAreaSeries,grouping: Option<LineGrouping>genuinely optional here too). LikeBar3DChart, the third (series) axis id is genuinely optional (axId minOccurs="2" maxOccurs="3"). - Area
Chart - An area chart (
<c:areaChart>,CT_AreaChart) — likeBarChart/LineChart, always paired with exactly two axes. - Area
Series - An area chart series (
<c:ser>inside<c:areaChart>,CT_AreaSer) — likeBarSeries, but with no marker (area charts have none). - Bar3D
Chart - A 3D bar/column chart (
<c:bar3DChart>,CT_Bar3DChart) — reusesEG_BarChartSharedexactly likeBarChart(sameBarSeries,direction/grouping/vary_colors/series), plus depth-specific fields. UnlikeBarChart, a third axis id (the series/depth axis) is genuinely optional here (axId minOccurs="2" maxOccurs="3"), modeled asseries_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 thanOption/Vec), oneCategoryAxisand oneValueAxis. - BarSeries
- A bar/column chart series (
<c:ser>inside<c:barChart>,CT_BarSer). - Category
Axis - The category axis (
<c:catAx>,CT_CatAx) — paired with aValueAxisfor bar/line charts. Pie/Pie3D/Doughnut charts have no axes at all: confirmed structurally against the schema,CT_PieChart’sEG_PieChartSharedgroup has noaxIdelement whatsoever, unlikeCT_BarChart/CT_LineChartwhich 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 inPlotArea::charts. - Chart
Space - The chart part’s root element (
<c:chartSpace>,CT_ChartSpace) — the whole content of a chart XML part (e.g.xl/charts/chart1.xml). Unlikedrawing’s fragment-only functions, this crate’s reader/writer forChartSpaceproduce/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 (seelib.rs’s doc comment). - Doughnut
Chart - A doughnut chart (
<c:doughnutChart>,CT_DoughnutChart) — reusesEG_PieChartSharedexactly likePieChart(the samePieSeries, no new series type needed), plus a hole size. Structurally axis-less, same asPieChart(confirmed the same way:EG_PieChartSharedhas noaxId). - Legend
- The chart’s legend (
<c:legend>,CT_Legend). - Line3D
Chart - A 3D line chart (
<c:line3DChart>,CT_Line3DChart) — reusesEG_LineChartSharedexactly likeLineChart(sameLineSeries,groupingnon-Optionfor the same reason asLineChart::grouping). UnlikeBar3DChart/Area3DChart, the third (series) axis id is strictly required here (axId minOccurs="3" maxOccurs="3", not2.3), so all three axis ids are plainu32, notOption. - Line
Chart - A line chart (
<c:lineChart>,CT_LineChart) — likeBarChart, always paired with exactly two axes. - Line
Series - A line chart series (
<c:ser>inside<c:lineChart>,CT_LineSer). - Marker
- A line/scatter/radar series’ marker (
<c:marker>,CT_Marker). - Numeric
Data - A numeric cache (
CT_NumData) — either the snapshot of a cell range’s values (inside aNumericDataSource::Reference) or the literal values themselves (inside aNumericDataSource::Literal). - Numeric
Point - One point in a numeric cache (
<c:pt idx=".." formatCode="..">,CT_NumVal). Kept as the raw text<c:v>holds (the schema types it ass:ST_Xstring, an arbitrary string, not literally a number) rather than parsed intof64— the same “no floating-point rounding drift, exact round-trip” posture this workspace already applies to unit-suffixed fields elsewhere. - Pie3D
Chart - A 3D pie chart (
<c:pie3DChart>,CT_Pie3DChart) — reusesEG_PieChartSharedexactly likePieChart/DoughnutChart(samePieSeries), with no fields of its own at all — confirmed against the schema:CT_Pie3DChartis just the shared group plusextLst, unlikeDoughnutChartwhich addsholeSize/firstSliceAng. Structurally axis-less, like every other pie-family chart. - PieChart
- A pie chart (
<c:pieChart>,CT_PieChart) — structurally axis-less (seeCategoryAxis’s doc comment for the schema confirmation), unlikeBarChart/LineChart. - PieSeries
- A pie chart series (
<c:ser>inside<c:pieChart>,CT_PieSer) — structurally simpler thanBarSeries/LineSeries: no marker (pie slices have none), and the chart itself has no axes at all (seePieChart’s doc comment). - Plot
Area - 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. - Scatter
Chart - A scatter chart (
<c:scatterChart>,CT_ScatterChart) — like other chart types, paired with exactly two axes (both value axes in practice, namedx_axis_id/y_axis_idhere rather thancategory_axis_id/value_axis_idsince a scatter chart has no category axis at all). - Scatter
Series - A scatter chart series (
<c:ser>inside<c:scatterChart>,CT_ScatterSer) — usesxVal/yValinstead ofcat/val: a scatter chart has no category axis, both axes are numeric value axes. - String
Data - A string cache (
CT_StrData). - String
Point - 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>, allCT_Surface) — the same type reused for all three, exactly as the schema does. - Surface3D
Chart - A 3D surface chart (
<c:surface3DChart>,CT_Surface3DChart,EG_SurfaceChartShared). LikeLine3DChart, all three axis ids are strictly required here (axId minOccurs="3" maxOccurs="3") — unlikeBar3DChart/Area3DChart’s genuinely optional third axis. - Surface
Series - A surface chart series (
<c:ser>inside<c:surface3DChart>/<c:surfaceChart>,CT_SurfaceSer) — unlike every other series type in this crate, has nospPrand nomarker(confirmed against the schema: a surface’s banding is formatted globally viabandFmts/theSurfacewall dressing, not per series). - Title
- A chart or axis title (
<c:title>,CT_Title) — reused identically byCT_Chart’s own title and by each axis’s title (EG_AxShared::title). - Value
Axis - The value axis (
<c:valAx>,CT_ValAx) — seeCategoryAxis’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 noLineChart::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 explicitSome. - 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) anddateAx(date axis) are deferred. - Axis
Data Source - 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. - Axis
Position ST_AxPos— which side of the plot area an axis is drawn on.- Bar3D
Shape ST_Shape— the physical shape used for each bar in a 3D bar/column chart (<c:shape>insideCT_Bar3DChart). The whole<c:shape>element is optional (minOccurs="0", attribute default"box"), so modeledOption<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.- Chart
Type - 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. - Cross
Between ST_CrossBetween— value axis only: whether the category axis crosses the value axis between categories or at the category’s midpoint.- Display
Blanks As ST_DispBlanksAs.- Error
- Errors that can occur while reading or writing chart XML.
- Legend
Position ST_LegendPos.- Line
Grouping ST_Grouping— shared by line/area charts (bar charts use the largerBarGrouping, which additionally hasclustered).- Marker
Symbol ST_MarkerStyle— the shape drawn at each data point of a line/scatter/ radar series.- Numeric
Data Source - A numeric data source (
CT_NumDataSource‘snumRef/numLitchoice) — values that are always numbers, e.g. a series’<c:val>. - Scatter
Style ST_ScatterStyle— required by the schema (minOccurs="1", default"marker"), so modeled as a plain, non-Optionfield with#[default]from the start, avoiding the kind of round-tripping hazard a schema-required element modeled asOptionwould create.- Series
Title - A series’ name (
CT_SerTx) — either a cell reference (with an optional single cached string — the schema’s ownstrCacheis a fullStringDatalist, but a series title only ever uses its first point in practice, so this simplifies it toOption<String>) or a literal string with no cell reference at all. - String
Data Source - A string data source (
CT_StrRef/CT_StrDatachoice, used standalone for e.g. a scatter/bubble series — bar/line/pie series instead useAxisDataSourcefor categories, see below). - Title
Text - A title’s text content (
CT_Tx) — either rich text (reusingdrawing::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.