Skip to main content

excelize_rs/xml/
chart.rs

1//! Chart part (`xl/charts/chartN.xml`).
2//!
3//! Ported from Go `xmlChart.go`.
4
5use serde::{Deserialize, Serialize};
6
7use super::common::{
8    AttrValBool, AttrValFloat, AttrValInt, AttrValString, RichTextRun, XlsxExtLst,
9};
10use super::drawing::{ABodyPr, ALn, AP, ASchemeClr, ASolidFill, Fill, GraphicOptions, LineOptions};
11use crate::styles::{Alignment, Font};
12
13// ------------------------------------------------------------------
14// Root chart-space element
15// ------------------------------------------------------------------
16
17/// Directly maps the chartSpace element. The chart namespace in DrawingML is
18/// for representing visualizations of numeric data with column charts, pie
19/// charts, scatter charts, or other types of charts.
20#[derive(Debug, Default, Clone, PartialEq, Serialize, Deserialize)]
21#[serde(rename = "c:chartSpace")]
22pub struct XlsxChartSpace {
23    #[serde(rename = "@xmlns:c", default)]
24    pub xmlns_c: Option<String>,
25    #[serde(rename = "@xmlns:a", default)]
26    pub xmlns_a: Option<String>,
27    #[serde(rename = "c:date1904", default)]
28    pub date_1904: Option<AttrValBool>,
29    #[serde(rename = "c:lang", default)]
30    pub lang: Option<AttrValString>,
31    #[serde(rename = "c:roundedCorners", default)]
32    pub rounded_corners: Option<AttrValBool>,
33    #[serde(rename = "c:chart", default)]
34    pub chart: CChart,
35    #[serde(rename = "c:spPr", default)]
36    pub sp_pr: Option<CSpPr>,
37    #[serde(rename = "c:txPr", default)]
38    pub tx_pr: Option<CTxPr>,
39    #[serde(rename = "c:printSettings", default)]
40    pub print_settings: Option<CPrintSettings>,
41}
42
43// ------------------------------------------------------------------
44// Chart container
45// ------------------------------------------------------------------
46
47/// Directly maps the element that specifies the thickness of the walls or
48/// floor as a percentage of the largest dimension of the plot volume and
49/// SpPr element.
50#[derive(Debug, Default, Clone, PartialEq, Serialize, Deserialize)]
51pub struct CThicknessSpPr {
52    #[serde(rename = "c:thickness", default)]
53    pub thickness: Option<AttrValInt>,
54    #[serde(rename = "c:spPr", default)]
55    pub sp_pr: Option<CSpPr>,
56}
57
58/// Directly maps the chart element. This element specifies a title.
59#[derive(Debug, Default, Clone, PartialEq, Serialize, Deserialize)]
60pub struct CChart {
61    #[serde(rename = "c:title", default)]
62    pub title: Option<CTitle>,
63    #[serde(rename = "c:autoTitleDeleted", default)]
64    pub auto_title_deleted: Option<CAutoTitleDeleted>,
65    #[serde(rename = "c:view3D", default)]
66    pub view_3d: Option<CView3D>,
67    #[serde(rename = "c:floor", default)]
68    pub floor: Option<CThicknessSpPr>,
69    #[serde(rename = "c:sideWall", default)]
70    pub side_wall: Option<CThicknessSpPr>,
71    #[serde(rename = "c:backWall", default)]
72    pub back_wall: Option<CThicknessSpPr>,
73    #[serde(rename = "c:plotArea", default)]
74    pub plot_area: Option<CPlotArea>,
75    #[serde(rename = "c:legend", default)]
76    pub legend: Option<CLegend>,
77    #[serde(rename = "c:plotVisOnly", default)]
78    pub plot_vis_only: Option<AttrValBool>,
79    #[serde(rename = "c:dispBlanksAs", default)]
80    pub disp_blanks_as: Option<AttrValString>,
81    #[serde(rename = "c:showDLblsOverMax", default)]
82    pub show_d_lbls_over_max: Option<AttrValBool>,
83}
84
85/// Directly maps the title element. This element specifies a title.
86#[derive(Debug, Default, Clone, PartialEq, Serialize, Deserialize)]
87pub struct CTitle {
88    #[serde(rename = "c:tx", default)]
89    pub tx: Option<CTx>,
90    #[serde(rename = "c:layout", default)]
91    pub layout: Option<CLayout>,
92    #[serde(rename = "c:overlay", default)]
93    pub overlay: Option<AttrValBool>,
94    #[serde(rename = "c:spPr", default)]
95    pub sp_pr: Option<CSpPr>,
96    #[serde(rename = "c:txPr", default)]
97    pub tx_pr: Option<CTxPr>,
98    #[serde(rename = "c:extLst", default)]
99    pub ext_lst: Option<XlsxExtLst>,
100}
101
102/// Directly maps the layout element. This element specifies how the chart
103/// element is placed on the chart.
104#[derive(Debug, Default, Clone, PartialEq, Serialize, Deserialize)]
105pub struct CLayout {
106    #[serde(rename = "c:manualLayout", default)]
107    pub manual_layout: Option<CManualLayout>,
108    #[serde(rename = "c:extLst", default)]
109    pub ext_lst: Option<XlsxExtLst>,
110}
111
112/// Directly maps the manualLayout element. This element specifies the exact
113/// position of a chart element.
114#[derive(Debug, Default, Clone, PartialEq, Serialize, Deserialize)]
115pub struct CManualLayout {
116    #[serde(rename = "c:layoutTarget", default)]
117    pub layout_target: Option<AttrValString>,
118    #[serde(rename = "c:xMode", default)]
119    pub x_mode: Option<AttrValString>,
120    #[serde(rename = "c:yMode", default)]
121    pub y_mode: Option<AttrValString>,
122    #[serde(rename = "c:wMode", default)]
123    pub w_mode: Option<AttrValString>,
124    #[serde(rename = "c:hMode", default)]
125    pub h_mode: Option<AttrValString>,
126    #[serde(rename = "c:x", default)]
127    pub x: Option<AttrValFloat>,
128    #[serde(rename = "c:y", default)]
129    pub y: Option<AttrValFloat>,
130    #[serde(rename = "c:w", default)]
131    pub w: Option<AttrValFloat>,
132    #[serde(rename = "c:h", default)]
133    pub h: Option<AttrValFloat>,
134    #[serde(rename = "c:extLst", default)]
135    pub ext_lst: Option<XlsxExtLst>,
136}
137
138/// Directly maps the tx element. This element specifies text to use on a
139/// chart, including rich text formatting.
140#[derive(Debug, Default, Clone, PartialEq, Serialize, Deserialize)]
141pub struct CTx {
142    #[serde(rename = "c:strRef", default)]
143    pub str_ref: Option<CStrRef>,
144    #[serde(rename = "c:rich", default)]
145    pub rich: Option<CRich>,
146}
147
148/// Directly maps the rich element. This element contains a string with rich
149/// text formatting.
150#[derive(Debug, Default, Clone, PartialEq, Serialize, Deserialize)]
151pub struct CRich {
152    #[serde(rename = "a:bodyPr", default)]
153    pub body_pr: Option<ABodyPr>,
154    #[serde(rename = "a:lstStyle", default)]
155    pub lst_style: Option<String>,
156    #[serde(rename = "a:p", default)]
157    pub p: Vec<AP>,
158}
159
160// ------------------------------------------------------------------
161// Shape / text properties (chart variants)
162// ------------------------------------------------------------------
163
164/// Directly maps the dTable element.
165#[derive(Debug, Default, Clone, PartialEq, Serialize, Deserialize)]
166pub struct CDTable {
167    #[serde(rename = "c:showHorzBorder", default)]
168    pub show_horz_border: Option<AttrValBool>,
169    #[serde(rename = "c:showVertBorder", default)]
170    pub show_vert_border: Option<AttrValBool>,
171    #[serde(rename = "c:showOutline", default)]
172    pub show_outline: Option<AttrValBool>,
173    #[serde(rename = "c:showKeys", default)]
174    pub show_keys: Option<AttrValBool>,
175    #[serde(rename = "c:spPr", default)]
176    pub sp_pr: Option<CSpPr>,
177    #[serde(rename = "c:txPr", default)]
178    pub tx_pr: Option<CTxPr>,
179    #[serde(rename = "c:extLst", default)]
180    pub ext_lst: Option<XlsxExtLst>,
181}
182
183/// Directly maps the spPr element. This element specifies the visual shape
184/// properties that can be applied to a shape. These properties include the
185/// shape fill, outline, geometry, effects, and 3D orientation.
186#[derive(Debug, Default, Clone, PartialEq, Serialize, Deserialize)]
187pub struct CSpPr {
188    #[serde(rename = "a:noFill", default)]
189    pub no_fill: Option<String>,
190    #[serde(rename = "a:solidFill", default)]
191    pub solid_fill: Option<ASolidFill>,
192    #[serde(rename = "a:ln", default)]
193    pub ln: Option<ALn>,
194    #[serde(rename = "a:sp3d", default)]
195    pub sp_3d: Option<ASp3D>,
196    #[serde(rename = "a:effectLst", default)]
197    pub effect_lst: Option<String>,
198}
199
200/// Directly maps the a:sp3d element. This element defines the 3D properties
201/// associated with a particular shape in DrawingML.
202#[derive(Debug, Default, Clone, PartialEq, Eq, Serialize, Deserialize)]
203pub struct ASp3D {
204    #[serde(rename = "@contourW", default)]
205    pub contour_w: i64,
206    #[serde(rename = "a:contourClr", default)]
207    pub contour_clr: Option<AContourClr>,
208}
209
210/// Directly maps the a:contourClr element. This element defines the color
211/// for the contour on a shape.
212#[derive(Debug, Default, Clone, PartialEq, Eq, Serialize, Deserialize)]
213pub struct AContourClr {
214    #[serde(rename = "a:schemeClr", default)]
215    pub scheme_clr: Option<ASchemeClr>,
216}
217
218/// Directly maps the txPr element. This element specifies text formatting.
219/// The lstStyle element is not supported.
220#[derive(Debug, Default, Clone, PartialEq, Serialize, Deserialize)]
221pub struct CTxPr {
222    #[serde(rename = "a:bodyPr", default)]
223    pub body_pr: Option<ABodyPr>,
224    #[serde(rename = "a:lstStyle", default)]
225    pub lst_style: Option<String>,
226    #[serde(rename = "a:p", default)]
227    pub p: Option<AP>,
228}
229
230// ------------------------------------------------------------------
231// View / plot area
232// ------------------------------------------------------------------
233
234/// Directly maps the autoTitleDeleted element. This element specifies the
235/// title shall not be shown for this chart.
236#[derive(Debug, Default, Clone, PartialEq, Eq, Serialize, Deserialize)]
237pub struct CAutoTitleDeleted {
238    #[serde(rename = "@val", default)]
239    pub val: bool,
240}
241
242/// Directly maps the view3D element. This element specifies the 3-D view of
243/// the chart.
244#[derive(Debug, Default, Clone, PartialEq, Eq, Serialize, Deserialize)]
245pub struct CView3D {
246    #[serde(rename = "c:rotX", default)]
247    pub rot_x: Option<AttrValInt>,
248    #[serde(rename = "c:rotY", default)]
249    pub rot_y: Option<AttrValInt>,
250    #[serde(rename = "c:rAngAx", default)]
251    pub r_ang_ax: Option<AttrValInt>,
252    #[serde(rename = "c:depthPercent", default)]
253    pub depth_percent: Option<AttrValInt>,
254    #[serde(rename = "c:perspective", default)]
255    pub perspective: Option<AttrValInt>,
256    #[serde(rename = "c:extLst", default)]
257    pub ext_lst: Option<XlsxExtLst>,
258}
259
260/// Directly maps the plotArea element. This element specifies the plot area
261/// of the chart.
262#[derive(Debug, Default, Clone, PartialEq, Serialize, Deserialize)]
263pub struct CPlotArea {
264    #[serde(rename = "c:layout", default)]
265    pub layout: Option<String>,
266    #[serde(rename = "c:areaChart", default)]
267    pub area_chart: Vec<CCharts>,
268    #[serde(rename = "c:area3DChart", default)]
269    pub area_3d_chart: Vec<CCharts>,
270    #[serde(rename = "c:barChart", default)]
271    pub bar_chart: Vec<CCharts>,
272    #[serde(rename = "c:bar3DChart", default)]
273    pub bar_3d_chart: Vec<CCharts>,
274    #[serde(rename = "c:bubbleChart", default)]
275    pub bubble_chart: Vec<CCharts>,
276    #[serde(rename = "c:doughnutChart", default)]
277    pub doughnut_chart: Vec<CCharts>,
278    #[serde(rename = "c:lineChart", default)]
279    pub line_chart: Vec<CCharts>,
280    #[serde(rename = "c:line3DChart", default)]
281    pub line_3d_chart: Vec<CCharts>,
282    #[serde(rename = "c:stockChart", default)]
283    pub stock_chart: Vec<CCharts>,
284    #[serde(rename = "c:pieChart", default)]
285    pub pie_chart: Vec<CCharts>,
286    #[serde(rename = "c:pie3DChart", default)]
287    pub pie_3d_chart: Vec<CCharts>,
288    #[serde(rename = "c:ofPieChart", default)]
289    pub of_pie_chart: Vec<CCharts>,
290    #[serde(rename = "c:radarChart", default)]
291    pub radar_chart: Vec<CCharts>,
292    #[serde(rename = "c:scatterChart", default)]
293    pub scatter_chart: Vec<CCharts>,
294    #[serde(rename = "c:surface3DChart", default)]
295    pub surface_3d_chart: Vec<CCharts>,
296    #[serde(rename = "c:surfaceChart", default)]
297    pub surface_chart: Vec<CCharts>,
298    #[serde(rename = "c:catAx", default)]
299    pub cat_ax: Vec<CAxs>,
300    #[serde(rename = "c:valAx", default)]
301    pub val_ax: Vec<CAxs>,
302    #[serde(rename = "c:dateAx", default)]
303    pub date_ax: Vec<CAxs>,
304    #[serde(rename = "c:serAx", default)]
305    pub ser_ax: Vec<CAxs>,
306    #[serde(rename = "c:dTable", default)]
307    pub d_table: Option<CDTable>,
308    #[serde(rename = "c:spPr", default)]
309    pub sp_pr: Option<CSpPr>,
310}
311
312/// Specifies the common element of the chart.
313#[derive(Debug, Default, Clone, PartialEq, Serialize, Deserialize)]
314pub struct CCharts {
315    #[serde(rename = "c:barDir", default)]
316    pub bar_dir: Option<AttrValString>,
317    #[serde(rename = "c:bubbleScale", default)]
318    pub bubble_scale: Option<AttrValFloat>,
319    #[serde(rename = "c:grouping", default)]
320    pub grouping: Option<AttrValString>,
321    #[serde(rename = "c:radarStyle", default)]
322    pub radar_style: Option<AttrValString>,
323    #[serde(rename = "c:scatterStyle", default)]
324    pub scatter_style: Option<AttrValString>,
325    #[serde(rename = "c:ofPieType", default)]
326    pub of_pie_type: Option<AttrValString>,
327    #[serde(rename = "c:varyColors", default)]
328    pub vary_colors: Option<AttrValBool>,
329    #[serde(rename = "c:wireframe", default)]
330    pub wireframe: Option<AttrValBool>,
331    #[serde(rename = "c:ser", default)]
332    pub ser: Option<Vec<CSer>>,
333    #[serde(rename = "c:splitPos", default)]
334    pub split_pos: Option<AttrValInt>,
335    #[serde(rename = "c:serLines", default)]
336    pub ser_lines: Option<AttrValString>,
337    #[serde(rename = "c:dLbls", default)]
338    pub d_lbls: Option<CDLbls>,
339    #[serde(rename = "c:dropLines", default)]
340    pub drop_lines: Option<CLines>,
341    #[serde(rename = "c:hiLowLines", default)]
342    pub hi_low_lines: Option<CLines>,
343    #[serde(rename = "c:upDownBars", default)]
344    pub up_down_bars: Option<CUpDownBars>,
345    #[serde(rename = "c:gapWidth", default)]
346    pub gap_width: Option<AttrValInt>,
347    #[serde(rename = "c:shape", default)]
348    pub shape: Option<AttrValString>,
349    #[serde(rename = "c:holeSize", default)]
350    pub hole_size: Option<AttrValInt>,
351    #[serde(rename = "c:smooth", default)]
352    pub smooth: Option<AttrValBool>,
353    #[serde(rename = "c:overlap", default)]
354    pub overlap: Option<AttrValInt>,
355    #[serde(rename = "c:axId", default)]
356    pub ax_id: Vec<AttrValInt>,
357}
358
359/// Directly maps the catAx and valAx element.
360#[derive(Debug, Default, Clone, PartialEq, Serialize, Deserialize)]
361pub struct CAxs {
362    #[serde(rename = "c:axId", default)]
363    pub ax_id: Option<AttrValInt>,
364    #[serde(rename = "c:scaling", default)]
365    pub scaling: Option<CScaling>,
366    #[serde(rename = "c:delete", default)]
367    pub delete: Option<AttrValBool>,
368    #[serde(rename = "c:axPos", default)]
369    pub ax_pos: Option<AttrValString>,
370    #[serde(rename = "c:majorGridlines", default)]
371    pub major_gridlines: Option<CLines>,
372    #[serde(rename = "c:minorGridlines", default)]
373    pub minor_gridlines: Option<CLines>,
374    #[serde(rename = "c:title", default)]
375    pub title: Option<CTitle>,
376    #[serde(rename = "c:numFmt", default)]
377    pub num_fmt: Option<CNumFmt>,
378    #[serde(rename = "c:majorTickMark", default)]
379    pub major_tick_mark: Option<AttrValString>,
380    #[serde(rename = "c:minorTickMark", default)]
381    pub minor_tick_mark: Option<AttrValString>,
382    #[serde(rename = "c:tickLblPos", default)]
383    pub tick_lbl_pos: Option<AttrValString>,
384    #[serde(rename = "c:spPr", default)]
385    pub sp_pr: Option<CSpPr>,
386    #[serde(rename = "c:txPr", default)]
387    pub tx_pr: Option<CTxPr>,
388    #[serde(rename = "c:crossAx", default)]
389    pub cross_ax: Option<AttrValInt>,
390    #[serde(rename = "c:crosses", default)]
391    pub crosses: Option<AttrValString>,
392    #[serde(rename = "c:crossBetween", default)]
393    pub cross_between: Option<AttrValString>,
394    #[serde(rename = "c:majorUnit", default)]
395    pub major_unit: Option<AttrValFloat>,
396    #[serde(rename = "c:minorUnit", default)]
397    pub minor_unit: Option<AttrValFloat>,
398    #[serde(rename = "c:auto", default)]
399    pub auto: Option<AttrValBool>,
400    #[serde(rename = "c:lblAlgn", default)]
401    pub lbl_algn: Option<AttrValString>,
402    #[serde(rename = "c:lblOffset", default)]
403    pub lbl_offset: Option<AttrValInt>,
404    #[serde(rename = "c:tickLblSkip", default)]
405    pub tick_lbl_skip: Option<AttrValInt>,
406    #[serde(rename = "c:tickMarkSkip", default)]
407    pub tick_mark_skip: Option<AttrValInt>,
408    #[serde(rename = "c:noMultiLvlLbl", default)]
409    pub no_multi_lvl_lbl: Option<AttrValBool>,
410}
411
412/// Directly maps the upDownBars element. This element specifies the up and
413/// down bars.
414#[derive(Debug, Default, Clone, PartialEq, Serialize, Deserialize)]
415pub struct CUpDownBars {
416    #[serde(rename = "c:gapWidth", default)]
417    pub gap_width: Option<AttrValString>,
418    #[serde(rename = "c:upBars", default)]
419    pub up_bars: Option<CLines>,
420    #[serde(rename = "c:downBars", default)]
421    pub down_bars: Option<CLines>,
422    #[serde(rename = "c:extLst", default)]
423    pub ext_lst: Option<XlsxExtLst>,
424}
425
426/// Directly maps the chart lines content model.
427#[derive(Debug, Default, Clone, PartialEq, Serialize, Deserialize)]
428pub struct CLines {
429    #[serde(rename = "c:spPr", default)]
430    pub sp_pr: Option<CSpPr>,
431}
432
433/// Directly maps the scaling element. This element contains additional axis
434/// settings.
435#[derive(Debug, Default, Clone, PartialEq, Serialize, Deserialize)]
436pub struct CScaling {
437    #[serde(rename = "c:logBase", default)]
438    pub log_base: Option<AttrValFloat>,
439    #[serde(rename = "c:orientation", default)]
440    pub orientation: Option<AttrValString>,
441    #[serde(rename = "c:max", default)]
442    pub max: Option<AttrValFloat>,
443    #[serde(rename = "c:min", default)]
444    pub min: Option<AttrValFloat>,
445}
446
447/// Directly maps the numFmt element. This element specifies number formatting
448/// for the parent element.
449#[derive(Debug, Default, Clone, PartialEq, Eq, Serialize, Deserialize)]
450pub struct CNumFmt {
451    #[serde(rename = "@formatCode", default)]
452    pub format_code: String,
453    #[serde(rename = "@sourceLinked", default)]
454    pub source_linked: bool,
455}
456
457// ------------------------------------------------------------------
458// Series / data
459// ------------------------------------------------------------------
460
461/// Directly maps the ser element. This element specifies a series on a chart.
462#[derive(Debug, Default, Clone, PartialEq, Serialize, Deserialize)]
463pub struct CSer {
464    #[serde(rename = "c:idx", default)]
465    pub idx: Option<AttrValInt>,
466    #[serde(rename = "c:order", default)]
467    pub order: Option<AttrValInt>,
468    #[serde(rename = "c:tx", default)]
469    pub tx: Option<CTx>,
470    #[serde(rename = "c:spPr", default)]
471    pub sp_pr: Option<CSpPr>,
472    #[serde(rename = "c:dPt", default)]
473    pub d_pt: Vec<CDPt>,
474    #[serde(rename = "c:dLbls", default)]
475    pub d_lbls: Option<CDLbls>,
476    #[serde(rename = "c:marker", default)]
477    pub marker: Option<CMarker>,
478    #[serde(rename = "c:invertIfNegative", default)]
479    pub invert_if_negative: Option<AttrValBool>,
480    #[serde(rename = "c:cat", default)]
481    pub cat: Option<CCat>,
482    #[serde(rename = "c:val", default)]
483    pub val: Option<CVal>,
484    #[serde(rename = "c:xVal", default)]
485    pub x_val: Option<CCat>,
486    #[serde(rename = "c:yVal", default)]
487    pub y_val: Option<CVal>,
488    #[serde(rename = "c:smooth", default)]
489    pub smooth: Option<AttrValBool>,
490    #[serde(rename = "c:bubbleSize", default)]
491    pub bubble_size: Option<CVal>,
492    #[serde(rename = "c:bubble3D", default)]
493    pub bubble_3d: Option<AttrValBool>,
494}
495
496/// Directly maps the marker element. This element specifies a data marker.
497#[derive(Debug, Default, Clone, PartialEq, Serialize, Deserialize)]
498pub struct CMarker {
499    #[serde(rename = "c:symbol", default)]
500    pub symbol: Option<AttrValString>,
501    #[serde(rename = "c:size", default)]
502    pub size: Option<AttrValInt>,
503    #[serde(rename = "c:spPr", default)]
504    pub sp_pr: Option<CSpPr>,
505}
506
507/// Directly maps the dPt element. This element specifies a single data point.
508#[derive(Debug, Default, Clone, PartialEq, Serialize, Deserialize)]
509pub struct CDPt {
510    #[serde(rename = "c:idx", default)]
511    pub idx: Option<AttrValInt>,
512    #[serde(rename = "c:bubble3D", default)]
513    pub bubble_3d: Option<AttrValBool>,
514    #[serde(rename = "c:spPr", default)]
515    pub sp_pr: Option<CSpPr>,
516}
517
518/// Directly maps the cat element. This element specifies the data used for
519/// the category axis.
520#[derive(Debug, Default, Clone, PartialEq, Serialize, Deserialize)]
521pub struct CCat {
522    #[serde(rename = "c:strRef", default)]
523    pub str_ref: Option<CStrRef>,
524}
525
526/// Directly maps the strRef element. This element specifies a reference to
527/// data for a single data label or title with a cache of the last values used.
528#[derive(Debug, Default, Clone, PartialEq, Eq, Serialize, Deserialize)]
529pub struct CStrRef {
530    #[serde(rename = "c:f", default)]
531    pub f: String,
532    #[serde(rename = "c:strCache", default)]
533    pub str_cache: Option<CStrCache>,
534}
535
536/// Directly maps the strCache element. This element specifies the last string
537/// data used for a chart.
538#[derive(Debug, Default, Clone, PartialEq, Eq, Serialize, Deserialize)]
539pub struct CStrCache {
540    #[serde(rename = "c:pt", default)]
541    pub pt: Vec<CPt>,
542    #[serde(rename = "c:ptCount", default)]
543    pub pt_count: Option<AttrValInt>,
544}
545
546/// Directly maps the pt element. This element specifies data for a particular
547/// data point.
548#[derive(Debug, Default, Clone, PartialEq, Eq, Serialize, Deserialize)]
549pub struct CPt {
550    #[serde(rename = "@idx", default)]
551    pub idx: i64,
552    #[serde(rename = "c:v", default)]
553    pub v: Option<String>,
554}
555
556/// Directly maps the val element. This element specifies the data values
557/// which shall be used to define the location of data markers on a chart.
558#[derive(Debug, Default, Clone, PartialEq, Serialize, Deserialize)]
559pub struct CVal {
560    #[serde(rename = "c:numRef", default)]
561    pub num_ref: Option<CNumRef>,
562}
563
564/// Directly maps the numRef element. This element specifies a reference to
565/// numeric data with a cache of the last values used.
566#[derive(Debug, Default, Clone, PartialEq, Eq, Serialize, Deserialize)]
567pub struct CNumRef {
568    #[serde(rename = "c:f", default)]
569    pub f: String,
570    #[serde(rename = "c:numCache", default)]
571    pub num_cache: Option<CNumCache>,
572}
573
574/// Directly maps the numCache element. This element specifies the last data
575/// shown on the chart for a series.
576#[derive(Debug, Default, Clone, PartialEq, Eq, Serialize, Deserialize)]
577pub struct CNumCache {
578    #[serde(rename = "c:formatCode", default)]
579    pub format_code: String,
580    #[serde(rename = "c:pt", default)]
581    pub pt: Vec<CPt>,
582    #[serde(rename = "c:ptCount", default)]
583    pub pt_count: Option<AttrValInt>,
584}
585
586/// Directly maps the dLbls element. This element serves as a root element
587/// that specifies the settings for the data labels for an entire series or
588/// the entire chart.
589#[derive(Debug, Default, Clone, PartialEq, Serialize, Deserialize)]
590pub struct CDLbls {
591    #[serde(rename = "c:numFmt", default)]
592    pub num_fmt: Option<CNumFmt>,
593    #[serde(rename = "c:spPr", default)]
594    pub sp_pr: Option<CSpPr>,
595    #[serde(rename = "c:txPr", default)]
596    pub tx_pr: Option<CTxPr>,
597    #[serde(rename = "c:dLblPos", default)]
598    pub d_lbl_pos: Option<AttrValString>,
599    #[serde(rename = "c:showLegendKey", default)]
600    pub show_legend_key: Option<AttrValBool>,
601    #[serde(rename = "c:showVal", default)]
602    pub show_val: Option<AttrValBool>,
603    #[serde(rename = "c:showCatName", default)]
604    pub show_cat_name: Option<AttrValBool>,
605    #[serde(rename = "c:showSerName", default)]
606    pub show_ser_name: Option<AttrValBool>,
607    #[serde(rename = "c:showPercent", default)]
608    pub show_percent: Option<AttrValBool>,
609    #[serde(rename = "c:showBubbleSize", default)]
610    pub show_bubble_size: Option<AttrValBool>,
611    #[serde(rename = "c:showLeaderLines", default)]
612    pub show_leader_lines: Option<AttrValBool>,
613}
614
615// ------------------------------------------------------------------
616// Legend / print settings
617// ------------------------------------------------------------------
618
619/// Directly maps the legendEntry element. This element specifies the legend
620/// entry.
621#[derive(Debug, Default, Clone, PartialEq, Serialize, Deserialize)]
622pub struct CLegendEntry {
623    #[serde(rename = "c:idx", default)]
624    pub idx: Option<AttrValInt>,
625    #[serde(rename = "c:txPr", default)]
626    pub tx_pr: Option<CTxPr>,
627}
628
629/// Directly maps the legend element. This element specifies the legend.
630#[derive(Debug, Default, Clone, PartialEq, Serialize, Deserialize)]
631pub struct CLegend {
632    #[serde(rename = "c:layout", default)]
633    pub layout: Option<String>,
634    #[serde(rename = "c:legendPos", default)]
635    pub legend_pos: Option<AttrValString>,
636    #[serde(rename = "c:legendEntry", default)]
637    pub legend_entry: Vec<CLegendEntry>,
638    #[serde(rename = "c:overlay", default)]
639    pub overlay: Option<AttrValBool>,
640    #[serde(rename = "c:spPr", default)]
641    pub sp_pr: Option<CSpPr>,
642    #[serde(rename = "c:txPr", default)]
643    pub tx_pr: Option<CTxPr>,
644}
645
646/// Directly maps the printSettings element. This element specifies the print
647/// settings for the chart.
648#[derive(Debug, Default, Clone, PartialEq, Serialize, Deserialize)]
649pub struct CPrintSettings {
650    #[serde(rename = "c:headerFooter", default)]
651    pub header_footer: Option<String>,
652    #[serde(rename = "c:pageMargins", default)]
653    pub page_margins: Option<CPageMargins>,
654    #[serde(rename = "c:pageSetup", default)]
655    pub page_setup: Option<String>,
656}
657
658/// Directly maps the pageMargins element. This element specifies the page
659/// margins for a chart.
660#[derive(Debug, Default, Clone, PartialEq, Serialize, Deserialize)]
661pub struct CPageMargins {
662    #[serde(rename = "@b", default)]
663    pub b: f64,
664    #[serde(rename = "@footer", default)]
665    pub footer: f64,
666    #[serde(rename = "@header", default)]
667    pub header: f64,
668    #[serde(rename = "@l", default)]
669    pub l: f64,
670    #[serde(rename = "@r", default)]
671    pub r: f64,
672    #[serde(rename = "@t", default)]
673    pub t: f64,
674}
675
676// ------------------------------------------------------------------
677// Public API types
678// ------------------------------------------------------------------
679
680/// Type of supported chart types.
681#[derive(Debug, Default, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
682pub struct ChartType(pub u8);
683
684impl ChartType {
685    pub const AREA: ChartType = ChartType(0);
686    pub const AREA_STACKED: ChartType = ChartType(1);
687    pub const AREA_PERCENT_STACKED: ChartType = ChartType(2);
688    pub const AREA_3D: ChartType = ChartType(3);
689    pub const AREA_3D_STACKED: ChartType = ChartType(4);
690    pub const AREA_3D_PERCENT_STACKED: ChartType = ChartType(5);
691    pub const BAR: ChartType = ChartType(6);
692    pub const BAR_STACKED: ChartType = ChartType(7);
693    pub const BAR_PERCENT_STACKED: ChartType = ChartType(8);
694    pub const BAR_3D_CLUSTERED: ChartType = ChartType(9);
695    pub const BAR_3D_STACKED: ChartType = ChartType(10);
696    pub const BAR_3D_PERCENT_STACKED: ChartType = ChartType(11);
697    pub const BAR_3D_CONE_CLUSTERED: ChartType = ChartType(12);
698    pub const BAR_3D_CONE_STACKED: ChartType = ChartType(13);
699    pub const BAR_3D_CONE_PERCENT_STACKED: ChartType = ChartType(14);
700    pub const BAR_3D_PYRAMID_CLUSTERED: ChartType = ChartType(15);
701    pub const BAR_3D_PYRAMID_STACKED: ChartType = ChartType(16);
702    pub const BAR_3D_PYRAMID_PERCENT_STACKED: ChartType = ChartType(17);
703    pub const BAR_3D_CYLINDER_CLUSTERED: ChartType = ChartType(18);
704    pub const BAR_3D_CYLINDER_STACKED: ChartType = ChartType(19);
705    pub const BAR_3D_CYLINDER_PERCENT_STACKED: ChartType = ChartType(20);
706    pub const COL: ChartType = ChartType(21);
707    pub const COL_STACKED: ChartType = ChartType(22);
708    pub const COL_PERCENT_STACKED: ChartType = ChartType(23);
709    pub const COL_3D: ChartType = ChartType(24);
710    pub const COL_3D_CLUSTERED: ChartType = ChartType(25);
711    pub const COL_3D_STACKED: ChartType = ChartType(26);
712    pub const COL_3D_PERCENT_STACKED: ChartType = ChartType(27);
713    pub const COL_3D_CONE: ChartType = ChartType(28);
714    pub const COL_3D_CONE_CLUSTERED: ChartType = ChartType(29);
715    pub const COL_3D_CONE_STACKED: ChartType = ChartType(30);
716    pub const COL_3D_CONE_PERCENT_STACKED: ChartType = ChartType(31);
717    pub const COL_3D_PYRAMID: ChartType = ChartType(32);
718    pub const COL_3D_PYRAMID_CLUSTERED: ChartType = ChartType(33);
719    pub const COL_3D_PYRAMID_STACKED: ChartType = ChartType(34);
720    pub const COL_3D_PYRAMID_PERCENT_STACKED: ChartType = ChartType(35);
721    pub const COL_3D_CYLINDER: ChartType = ChartType(36);
722    pub const COL_3D_CYLINDER_CLUSTERED: ChartType = ChartType(37);
723    pub const COL_3D_CYLINDER_STACKED: ChartType = ChartType(38);
724    pub const COL_3D_CYLINDER_PERCENT_STACKED: ChartType = ChartType(39);
725    pub const DOUGHNUT: ChartType = ChartType(40);
726    pub const LINE: ChartType = ChartType(41);
727    pub const LINE_3D: ChartType = ChartType(42);
728    pub const PIE: ChartType = ChartType(43);
729    pub const PIE_3D: ChartType = ChartType(44);
730    pub const PIE_OF_PIE: ChartType = ChartType(45);
731    pub const BAR_OF_PIE: ChartType = ChartType(46);
732    pub const RADAR: ChartType = ChartType(47);
733    pub const SCATTER: ChartType = ChartType(48);
734    pub const SURFACE_3D: ChartType = ChartType(49);
735    pub const WIREFRAME_SURFACE_3D: ChartType = ChartType(50);
736    pub const CONTOUR: ChartType = ChartType(51);
737    pub const WIREFRAME_CONTOUR: ChartType = ChartType(52);
738    pub const BUBBLE: ChartType = ChartType(53);
739    pub const BUBBLE_3D: ChartType = ChartType(54);
740    pub const STOCK_HIGH_LOW_CLOSE: ChartType = ChartType(55);
741    pub const STOCK_OPEN_HIGH_LOW_CLOSE: ChartType = ChartType(56);
742}
743
744/// Type of supported chart tick label position types.
745#[derive(Debug, Default, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
746pub struct ChartTickLabelPositionType(pub u8);
747
748impl ChartTickLabelPositionType {
749    pub const NEXT_TO_AXIS: ChartTickLabelPositionType = ChartTickLabelPositionType(0);
750    pub const HIGH: ChartTickLabelPositionType = ChartTickLabelPositionType(1);
751    pub const LOW: ChartTickLabelPositionType = ChartTickLabelPositionType(2);
752    pub const NONE: ChartTickLabelPositionType = ChartTickLabelPositionType(3);
753}
754
755/// Type of chart data labels position.
756#[derive(Debug, Default, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
757pub struct ChartDataLabelPositionType(pub u8);
758
759impl ChartDataLabelPositionType {
760    pub const UNSET: ChartDataLabelPositionType = ChartDataLabelPositionType(0);
761    pub const BEST_FIT: ChartDataLabelPositionType = ChartDataLabelPositionType(1);
762    pub const BELOW: ChartDataLabelPositionType = ChartDataLabelPositionType(2);
763    pub const CENTER: ChartDataLabelPositionType = ChartDataLabelPositionType(3);
764    pub const INSIDE_BASE: ChartDataLabelPositionType = ChartDataLabelPositionType(4);
765    pub const INSIDE_END: ChartDataLabelPositionType = ChartDataLabelPositionType(5);
766    pub const LEFT: ChartDataLabelPositionType = ChartDataLabelPositionType(6);
767    pub const OUTSIDE_END: ChartDataLabelPositionType = ChartDataLabelPositionType(7);
768    pub const RIGHT: ChartDataLabelPositionType = ChartDataLabelPositionType(8);
769    pub const ABOVE: ChartDataLabelPositionType = ChartDataLabelPositionType(9);
770}
771
772/// Directly maps the number format settings of the chart.
773#[derive(Debug, Default, Clone, PartialEq, Eq, Serialize, Deserialize)]
774pub struct ChartNumFmt {
775    #[serde(default)]
776    pub custom_num_fmt: String,
777    #[serde(default)]
778    pub source_linked: bool,
779}
780
781/// Directly maps the format settings of the chart axis.
782#[derive(Debug, Default, Clone, PartialEq, Serialize, Deserialize)]
783pub struct ChartAxis {
784    #[serde(default)]
785    pub none: bool,
786    #[serde(default)]
787    pub drop_lines: bool,
788    #[serde(default)]
789    pub high_low_lines: bool,
790    #[serde(default)]
791    pub major_grid_lines: bool,
792    #[serde(default)]
793    pub minor_grid_lines: bool,
794    #[serde(default)]
795    pub major_unit: f64,
796    #[serde(default)]
797    pub tick_label_position: ChartTickLabelPositionType,
798    #[serde(default)]
799    pub tick_label_skip: i64,
800    #[serde(default)]
801    pub reverse_order: bool,
802    #[serde(default)]
803    pub secondary: bool,
804    #[serde(default)]
805    pub maximum: Option<f64>,
806    #[serde(default)]
807    pub minimum: Option<f64>,
808    #[serde(default)]
809    pub alignment: Alignment,
810    #[serde(default)]
811    pub font: Font,
812    #[serde(default)]
813    pub log_base: f64,
814    #[serde(default)]
815    pub num_fmt: ChartNumFmt,
816    #[serde(default)]
817    pub title: ChartTitle,
818    #[serde(rename = "axID", default)]
819    pub ax_id: i64,
820}
821
822/// Directly maps the dimension of the chart.
823#[derive(Debug, Default, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
824pub struct ChartDimension {
825    pub width: u64,
826    pub height: u64,
827}
828
829/// Directly maps the format settings of the stock chart up bars and down
830/// bars.
831#[derive(Debug, Default, Clone, PartialEq, Serialize, Deserialize)]
832pub struct ChartUpDownBar {
833    pub fill: Fill,
834    pub border: LineOptions,
835}
836
837/// Directly maps the format settings of the plot area.
838#[derive(Debug, Default, Clone, PartialEq, Serialize, Deserialize)]
839pub struct ChartPlotArea {
840    #[serde(rename = "secondPlotValues", default)]
841    pub second_plot_values: i64,
842    #[serde(default)]
843    pub show_bubble_size: bool,
844    #[serde(default)]
845    pub show_cat_name: bool,
846    #[serde(default)]
847    pub show_data_table: bool,
848    #[serde(default)]
849    pub show_data_table_keys: bool,
850    #[serde(default)]
851    pub show_leader_lines: bool,
852    #[serde(default)]
853    pub show_percent: bool,
854    #[serde(default)]
855    pub show_ser_name: bool,
856    #[serde(default)]
857    pub show_val: bool,
858    pub fill: Fill,
859    pub up_bars: ChartUpDownBar,
860    pub down_bars: ChartUpDownBar,
861    pub num_fmt: ChartNumFmt,
862}
863
864/// Directly maps the format settings of the chart.
865#[derive(Debug, Default, Clone, PartialEq, Serialize, Deserialize)]
866pub struct Chart {
867    pub r#type: ChartType,
868    #[serde(default)]
869    pub series: Vec<ChartSeries>,
870    pub format: GraphicOptions,
871    pub dimension: ChartDimension,
872    pub legend: ChartLegend,
873    pub title: ChartTitle,
874    #[serde(default)]
875    pub vary_colors: Option<bool>,
876    pub x_axis: ChartAxis,
877    pub y_axis: ChartAxis,
878    pub plot_area: ChartPlotArea,
879    pub fill: Fill,
880    pub border: LineOptions,
881    #[serde(default)]
882    pub show_blanks_as: String,
883    #[serde(default)]
884    pub bubble_size: i64,
885    #[serde(default)]
886    pub hole_size: i64,
887    #[serde(default)]
888    pub gap_width: Option<u64>,
889    #[serde(default)]
890    pub overlap: Option<i64>,
891    #[serde(rename = "order", default)]
892    pub order: i64,
893    #[serde(default, skip_serializing)]
894    pub combo: Vec<Chart>,
895}
896
897/// Directly maps the format settings of the chart title.
898#[derive(Debug, Default, Clone, PartialEq, Serialize, Deserialize)]
899pub struct ChartTitle {
900    pub fill: Fill,
901    pub border: LineOptions,
902    #[serde(default)]
903    pub paragraph: Vec<RichTextRun>,
904    #[serde(default)]
905    pub font: Option<Font>,
906    #[serde(default)]
907    pub formula: String,
908    #[serde(default)]
909    pub offset_x: i64,
910    #[serde(default)]
911    pub offset_y: i64,
912    #[serde(default)]
913    pub width: i64,
914    #[serde(default)]
915    pub height: i64,
916    #[serde(default)]
917    pub overlay: bool,
918}
919
920/// Directly maps the format settings of the chart legend.
921#[derive(Debug, Default, Clone, PartialEq, Serialize, Deserialize)]
922pub struct ChartLegend {
923    #[serde(default)]
924    pub position: String,
925    #[serde(default)]
926    pub show_legend_key: bool,
927    #[serde(default)]
928    pub font: Option<Font>,
929}
930
931/// Directly maps the format settings of the chart marker.
932#[derive(Debug, Default, Clone, PartialEq, Serialize, Deserialize)]
933pub struct ChartMarker {
934    pub border: LineOptions,
935    pub fill: Fill,
936    #[serde(default)]
937    pub symbol: String,
938    #[serde(default)]
939    pub size: i64,
940}
941
942/// Directly maps the format settings of the chart labels.
943#[derive(Debug, Default, Clone, PartialEq, Serialize, Deserialize)]
944pub struct ChartDataLabel {
945    pub alignment: Alignment,
946    pub font: Font,
947    pub fill: Fill,
948}
949
950/// Directly maps the format settings of the chart data point for doughnut,
951/// pie and 3D pie charts.
952#[derive(Debug, Default, Clone, PartialEq, Serialize, Deserialize)]
953pub struct ChartDataPoint {
954    pub index: i64,
955    pub fill: Fill,
956}
957
958/// Directly maps the format settings of the chart series.
959#[derive(Debug, Default, Clone, PartialEq, Serialize, Deserialize)]
960pub struct ChartSeries {
961    #[serde(default)]
962    pub name: String,
963    #[serde(default)]
964    pub categories: String,
965    #[serde(default)]
966    pub values: String,
967    #[serde(default)]
968    pub sizes: String,
969    pub fill: Fill,
970    pub legend: ChartLegend,
971    pub line: LineOptions,
972    pub marker: ChartMarker,
973    pub data_label: ChartDataLabel,
974    pub data_label_position: ChartDataLabelPositionType,
975    #[serde(default)]
976    pub data_point: Vec<ChartDataPoint>,
977}