1use std::io::Cursor;
3
4use quick_xml::{
5 Reader,
6 Writer,
7 events::{
8 BytesStart,
9 Event,
10 },
11};
12
13use super::{
14 Area3DChart,
15 AreaChart,
16 AreaChartSeriesList,
17 Bar3DChart,
18 BarChart,
19 BubbleChart,
20 CategoryAxis,
21 DoughnutChart,
22 Formula,
23 GroupingValues,
24 Layout,
25 Line3DChart,
26 LineChart,
27 OfPieChart,
28 Pie3DChart,
29 PieChart,
30 RadarChart,
31 ScatterChart,
32 SeriesAxis,
33 ShapeProperties,
34 ValueAxis,
35};
36use crate::{
37 drawing::charts::DateAxis,
38 structs::Workbook,
39 traits::AdjustmentCoordinateWithSheet,
40 writer::driver::{
41 write_end_tag,
42 write_start_tag,
43 },
44 xml_read_loop,
45};
46
47#[derive(Clone, Default, Debug)]
48pub struct PlotArea {
49 layout: Layout,
50 line_chart: Option<LineChart>,
51 line_3d_chart: Option<Line3DChart>,
52 pie_chart: Option<PieChart>,
53 pie_3d_chart: Option<Pie3DChart>,
54 doughnut_chart: Option<DoughnutChart>,
55 scatter_chart: Option<ScatterChart>,
56 bar_chart: Option<BarChart>,
57 bar_3d_chart: Option<Bar3DChart>,
58 radar_chart: Option<RadarChart>,
59 bubble_chart: Option<BubbleChart>,
60 area_chart: Option<AreaChart>,
61 area_3d_chart: Option<Area3DChart>,
62 of_pie_chart: Option<OfPieChart>,
63 category_axis: Vec<CategoryAxis>,
64 date_axis: Vec<DateAxis>,
65 value_axis: Vec<ValueAxis>,
66 series_axis: Vec<SeriesAxis>,
67 shape_properties: Option<ShapeProperties>,
68}
69
70impl PlotArea {
71 #[must_use]
72 pub fn layout(&self) -> &Layout {
73 &self.layout
74 }
75
76 #[must_use]
77 #[deprecated(since = "3.0.0", note = "Use layout()")]
78 pub fn get_layout(&self) -> &Layout {
79 self.layout()
80 }
81
82 pub fn layout_mut(&mut self) -> &mut Layout {
83 &mut self.layout
84 }
85
86 #[deprecated(since = "3.0.0", note = "Use layout_mut()")]
87 pub fn get_layout_mut(&mut self) -> &mut Layout {
88 self.layout_mut()
89 }
90
91 pub fn set_layout(&mut self, value: Layout) -> &mut Self {
92 self.layout = value;
93 self
94 }
95
96 #[must_use]
97 pub fn line_chart(&self) -> Option<&LineChart> {
98 self.line_chart.as_ref()
99 }
100
101 #[must_use]
102 #[deprecated(since = "3.0.0", note = "Use line_chart()")]
103 pub fn get_line_chart(&self) -> Option<&LineChart> {
104 self.line_chart()
105 }
106
107 pub fn line_chart_mut(&mut self) -> Option<&mut LineChart> {
108 self.line_chart.as_mut()
109 }
110
111 #[deprecated(since = "3.0.0", note = "Use line_chart_mut()")]
112 pub fn get_line_chart_mut(&mut self) -> Option<&mut LineChart> {
113 self.line_chart_mut()
114 }
115
116 pub fn set_line_chart(&mut self, value: LineChart) -> &mut Self {
117 self.line_chart = Some(value);
118 self
119 }
120
121 #[must_use]
122 pub fn line_3d_chart(&self) -> Option<&Line3DChart> {
123 self.line_3d_chart.as_ref()
124 }
125
126 #[must_use]
127 #[deprecated(since = "3.0.0", note = "Use line_3d_chart()")]
128 pub fn get_line_3d_chart(&self) -> Option<&Line3DChart> {
129 self.line_3d_chart()
130 }
131
132 pub fn line_3d_chart_mut(&mut self) -> Option<&mut Line3DChart> {
133 self.line_3d_chart.as_mut()
134 }
135
136 #[deprecated(since = "3.0.0", note = "Use line_3d_chart_mut()")]
137 pub fn get_line_3d_chart_mut(&mut self) -> Option<&mut Line3DChart> {
138 self.line_3d_chart_mut()
139 }
140
141 pub fn set_line_3d_chart(&mut self, value: Line3DChart) -> &mut Self {
142 self.line_3d_chart = Some(value);
143 self
144 }
145
146 #[must_use]
147 pub fn pie_chart(&self) -> Option<&PieChart> {
148 self.pie_chart.as_ref()
149 }
150
151 #[must_use]
152 #[deprecated(since = "3.0.0", note = "Use pie_chart()")]
153 pub fn get_pie_chart(&self) -> Option<&PieChart> {
154 self.pie_chart()
155 }
156
157 pub fn pie_chart_mut(&mut self) -> Option<&mut PieChart> {
158 self.pie_chart.as_mut()
159 }
160
161 #[deprecated(since = "3.0.0", note = "Use pie_chart_mut()")]
162 pub fn get_pie_chart_mut(&mut self) -> Option<&mut PieChart> {
163 self.pie_chart_mut()
164 }
165
166 pub fn set_pie_chart(&mut self, value: PieChart) -> &mut Self {
167 self.pie_chart = Some(value);
168 self
169 }
170
171 #[must_use]
172 pub fn pie_3d_chart(&self) -> Option<&Pie3DChart> {
173 self.pie_3d_chart.as_ref()
174 }
175
176 #[must_use]
177 #[deprecated(since = "3.0.0", note = "Use pie_3d_chart()")]
178 pub fn get_pie_3d_chart(&self) -> Option<&Pie3DChart> {
179 self.pie_3d_chart()
180 }
181
182 pub fn pie_3d_chart_mut(&mut self) -> Option<&mut Pie3DChart> {
183 self.pie_3d_chart.as_mut()
184 }
185
186 #[deprecated(since = "3.0.0", note = "Use pie_3d_chart_mut()")]
187 pub fn get_pie_3d_chart_mut(&mut self) -> Option<&mut Pie3DChart> {
188 self.pie_3d_chart_mut()
189 }
190
191 pub fn set_pie_3d_chart(&mut self, value: Pie3DChart) -> &mut Self {
192 self.pie_3d_chart = Some(value);
193 self
194 }
195
196 #[must_use]
197 pub fn doughnut_chart(&self) -> Option<&DoughnutChart> {
198 self.doughnut_chart.as_ref()
199 }
200
201 #[must_use]
202 #[deprecated(since = "3.0.0", note = "Use doughnut_chart()")]
203 pub fn get_doughnut_chart(&self) -> Option<&DoughnutChart> {
204 self.doughnut_chart()
205 }
206
207 pub fn doughnut_chart_mut(&mut self) -> Option<&mut DoughnutChart> {
208 self.doughnut_chart.as_mut()
209 }
210
211 #[deprecated(since = "3.0.0", note = "Use doughnut_chart_mut()")]
212 pub fn get_doughnut_chart_mut(&mut self) -> Option<&mut DoughnutChart> {
213 self.doughnut_chart_mut()
214 }
215
216 pub fn set_doughnut_chart(&mut self, value: DoughnutChart) -> &mut Self {
217 self.doughnut_chart = Some(value);
218 self
219 }
220
221 #[must_use]
222 pub fn scatter_chart(&self) -> Option<&ScatterChart> {
223 self.scatter_chart.as_ref()
224 }
225
226 #[must_use]
227 #[deprecated(since = "3.0.0", note = "Use scatter_chart()")]
228 pub fn get_scatter_chart(&self) -> Option<&ScatterChart> {
229 self.scatter_chart()
230 }
231
232 pub fn scatter_chart_mut(&mut self) -> Option<&mut ScatterChart> {
233 self.scatter_chart.as_mut()
234 }
235
236 #[deprecated(since = "3.0.0", note = "Use scatter_chart_mut()")]
237 pub fn get_scatter_chart_mut(&mut self) -> Option<&mut ScatterChart> {
238 self.scatter_chart_mut()
239 }
240
241 pub fn set_scatter_chart(&mut self, value: ScatterChart) -> &mut Self {
242 self.scatter_chart = Some(value);
243 self
244 }
245
246 #[must_use]
247 pub fn bar_chart(&self) -> Option<&BarChart> {
248 self.bar_chart.as_ref()
249 }
250
251 #[must_use]
252 #[deprecated(since = "3.0.0", note = "Use bar_chart()")]
253 pub fn get_bar_chart(&self) -> Option<&BarChart> {
254 self.bar_chart()
255 }
256
257 pub fn bar_chart_mut(&mut self) -> Option<&mut BarChart> {
258 self.bar_chart.as_mut()
259 }
260
261 #[deprecated(since = "3.0.0", note = "Use bar_chart_mut()")]
262 pub fn get_bar_chart_mut(&mut self) -> Option<&mut BarChart> {
263 self.bar_chart_mut()
264 }
265
266 pub fn set_bar_chart(&mut self, value: BarChart) -> &mut Self {
267 self.bar_chart = Some(value);
268 self
269 }
270
271 #[must_use]
272 pub fn bar_3d_chart(&self) -> Option<&Bar3DChart> {
273 self.bar_3d_chart.as_ref()
274 }
275
276 #[must_use]
277 #[deprecated(since = "3.0.0", note = "Use bar_3d_chart()")]
278 pub fn get_bar_3d_chart(&self) -> Option<&Bar3DChart> {
279 self.bar_3d_chart()
280 }
281
282 pub fn bar_3d_chart_mut(&mut self) -> Option<&mut Bar3DChart> {
283 self.bar_3d_chart.as_mut()
284 }
285
286 #[deprecated(since = "3.0.0", note = "Use bar_3d_chart_mut()")]
287 pub fn get_bar_3d_chart_mut(&mut self) -> Option<&mut Bar3DChart> {
288 self.bar_3d_chart_mut()
289 }
290
291 pub fn set_bar_3d_chart(&mut self, value: Bar3DChart) -> &mut Self {
292 self.bar_3d_chart = Some(value);
293 self
294 }
295
296 #[must_use]
297 pub fn radar_chart(&self) -> Option<&RadarChart> {
298 self.radar_chart.as_ref()
299 }
300
301 #[must_use]
302 #[deprecated(since = "3.0.0", note = "Use radar_chart()")]
303 pub fn get_radar_chart(&self) -> Option<&RadarChart> {
304 self.radar_chart()
305 }
306
307 pub fn radar_chart_mut(&mut self) -> Option<&mut RadarChart> {
308 self.radar_chart.as_mut()
309 }
310
311 #[deprecated(since = "3.0.0", note = "Use radar_chart_mut()")]
312 pub fn get_radar_chart_mut(&mut self) -> Option<&mut RadarChart> {
313 self.radar_chart_mut()
314 }
315
316 pub fn set_radar_chart(&mut self, value: RadarChart) -> &mut Self {
317 self.radar_chart = Some(value);
318 self
319 }
320
321 #[must_use]
322 pub fn bubble_chart(&self) -> Option<&BubbleChart> {
323 self.bubble_chart.as_ref()
324 }
325
326 #[must_use]
327 #[deprecated(since = "3.0.0", note = "Use bubble_chart()")]
328 pub fn get_bubble_chart(&self) -> Option<&BubbleChart> {
329 self.bubble_chart()
330 }
331
332 pub fn bubble_chart_mut(&mut self) -> Option<&mut BubbleChart> {
333 self.bubble_chart.as_mut()
334 }
335
336 #[deprecated(since = "3.0.0", note = "Use bubble_chart_mut()")]
337 pub fn get_bubble_chart_mut(&mut self) -> Option<&mut BubbleChart> {
338 self.bubble_chart_mut()
339 }
340
341 pub fn set_bubble_chart(&mut self, value: BubbleChart) -> &mut Self {
342 self.bubble_chart = Some(value);
343 self
344 }
345
346 #[must_use]
347 pub fn area_chart(&self) -> Option<&AreaChart> {
348 self.area_chart.as_ref()
349 }
350
351 #[must_use]
352 #[deprecated(since = "3.0.0", note = "Use area_chart()")]
353 pub fn get_area_chart(&self) -> Option<&AreaChart> {
354 self.area_chart()
355 }
356
357 pub fn area_chart_mut(&mut self) -> Option<&mut AreaChart> {
358 self.area_chart.as_mut()
359 }
360
361 #[deprecated(since = "3.0.0", note = "Use area_chart_mut()")]
362 pub fn get_area_chart_mut(&mut self) -> Option<&mut AreaChart> {
363 self.area_chart_mut()
364 }
365
366 pub fn set_area_chart(&mut self, value: AreaChart) -> &mut Self {
367 self.area_chart = Some(value);
368 self
369 }
370
371 #[must_use]
372 pub fn area_3d_chart(&self) -> Option<&Area3DChart> {
373 self.area_3d_chart.as_ref()
374 }
375
376 #[must_use]
377 #[deprecated(since = "3.0.0", note = "Use area_3d_chart()")]
378 pub fn get_area_3d_chart(&self) -> Option<&Area3DChart> {
379 self.area_3d_chart()
380 }
381
382 pub fn area_3d_chart_mut(&mut self) -> Option<&mut Area3DChart> {
383 self.area_3d_chart.as_mut()
384 }
385
386 #[deprecated(since = "3.0.0", note = "Use area_3d_chart_mut()")]
387 pub fn get_area_3d_chart_mut(&mut self) -> Option<&mut Area3DChart> {
388 self.area_3d_chart_mut()
389 }
390
391 pub fn set_area_3d_chart(&mut self, value: Area3DChart) -> &mut Self {
392 self.area_3d_chart = Some(value);
393 self
394 }
395
396 #[must_use]
397 pub fn of_pie_chart(&self) -> Option<&OfPieChart> {
398 self.of_pie_chart.as_ref()
399 }
400
401 #[must_use]
402 #[deprecated(since = "3.0.0", note = "Use of_pie_chart()")]
403 pub fn get_of_pie_chart(&self) -> Option<&OfPieChart> {
404 self.of_pie_chart()
405 }
406
407 pub fn of_pie_chart_mut(&mut self) -> Option<&mut OfPieChart> {
408 self.of_pie_chart.as_mut()
409 }
410
411 #[deprecated(since = "3.0.0", note = "Use of_pie_chart_mut()")]
412 pub fn get_of_pie_chart_mut(&mut self) -> Option<&mut OfPieChart> {
413 self.of_pie_chart_mut()
414 }
415
416 pub fn set_of_pie_chart(&mut self, value: OfPieChart) -> &mut Self {
417 self.of_pie_chart = Some(value);
418 self
419 }
420
421 #[must_use]
422 pub fn category_axis(&self) -> &[CategoryAxis] {
423 &self.category_axis
424 }
425
426 #[must_use]
427 #[deprecated(since = "3.0.0", note = "Use category_axis()")]
428 pub fn get_category_axis(&self) -> &[CategoryAxis] {
429 self.category_axis()
430 }
431
432 pub fn category_axis_mut(&mut self) -> &mut Vec<CategoryAxis> {
433 &mut self.category_axis
434 }
435
436 #[deprecated(since = "3.0.0", note = "Use category_axis_mut()")]
437 pub fn get_category_axis_mut(&mut self) -> &mut Vec<CategoryAxis> {
438 self.category_axis_mut()
439 }
440
441 pub fn set_category_axis(&mut self, value: impl Into<Vec<CategoryAxis>>) -> &mut Self {
442 self.category_axis = value.into();
443 self
444 }
445
446 pub fn add_category_axis(&mut self, value: CategoryAxis) -> &mut Self {
447 self.category_axis.push(value);
448 self
449 }
450
451 #[must_use]
452 pub fn date_axis(&self) -> &[DateAxis] {
453 &self.date_axis
454 }
455
456 #[must_use]
457 #[deprecated(since = "3.0.0", note = "Use date_axis()")]
458 pub fn get_date_axis(&self) -> &[DateAxis] {
459 self.date_axis()
460 }
461
462 pub fn date_axis_mut(&mut self) -> &mut Vec<DateAxis> {
463 &mut self.date_axis
464 }
465
466 #[deprecated(since = "3.0.0", note = "Use date_axis_mut()")]
467 pub fn get_date_axis_mut(&mut self) -> &mut Vec<DateAxis> {
468 self.date_axis_mut()
469 }
470
471 pub fn set_date_axis(&mut self, value: impl Into<Vec<DateAxis>>) -> &mut Self {
472 self.date_axis = value.into();
473 self
474 }
475
476 pub fn add_date_axis(&mut self, value: DateAxis) -> &mut Self {
477 self.date_axis.push(value);
478 self
479 }
480
481 #[must_use]
482 pub fn value_axis(&self) -> &[ValueAxis] {
483 &self.value_axis
484 }
485
486 #[must_use]
487 #[deprecated(since = "3.0.0", note = "Use value_axis()")]
488 pub fn get_value_axis(&self) -> &[ValueAxis] {
489 self.value_axis()
490 }
491
492 pub fn value_axis_mut(&mut self) -> &mut Vec<ValueAxis> {
493 &mut self.value_axis
494 }
495
496 #[deprecated(since = "3.0.0", note = "Use value_axis_mut()")]
497 pub fn get_value_axis_mut(&mut self) -> &mut Vec<ValueAxis> {
498 self.value_axis_mut()
499 }
500
501 pub fn set_value_axis(&mut self, value: impl Into<Vec<ValueAxis>>) -> &mut Self {
502 self.value_axis = value.into();
503 self
504 }
505
506 pub fn add_value_axis(&mut self, value: ValueAxis) -> &mut Self {
507 self.value_axis.push(value);
508 self
509 }
510
511 #[must_use]
512 pub fn series_axis(&self) -> &[SeriesAxis] {
513 &self.series_axis
514 }
515
516 #[must_use]
517 #[deprecated(since = "3.0.0", note = "Use series_axis()")]
518 pub fn get_series_axis(&self) -> &[SeriesAxis] {
519 self.series_axis()
520 }
521
522 pub fn series_axis_mut(&mut self) -> &mut Vec<SeriesAxis> {
523 &mut self.series_axis
524 }
525
526 #[deprecated(since = "3.0.0", note = "Use series_axis_mut()")]
527 pub fn get_series_axis_mut(&mut self) -> &mut Vec<SeriesAxis> {
528 self.series_axis_mut()
529 }
530
531 pub fn set_series_axis(&mut self, value: impl Into<Vec<SeriesAxis>>) -> &mut Self {
532 self.series_axis = value.into();
533 self
534 }
535
536 pub fn add_series_axis(&mut self, value: SeriesAxis) -> &mut Self {
537 self.series_axis.push(value);
538 self
539 }
540
541 #[must_use]
542 pub fn shape_properties(&self) -> Option<&ShapeProperties> {
543 self.shape_properties.as_ref()
544 }
545
546 #[must_use]
547 #[deprecated(since = "3.0.0", note = "Use shape_properties()")]
548 pub fn get_shape_properties(&self) -> Option<&ShapeProperties> {
549 self.shape_properties()
550 }
551
552 pub fn shape_properties_mut(&mut self) -> Option<&mut ShapeProperties> {
553 self.shape_properties.as_mut()
554 }
555
556 #[deprecated(since = "3.0.0", note = "Use shape_properties_mut()")]
557 pub fn get_shape_properties_mut(&mut self) -> Option<&mut ShapeProperties> {
558 self.shape_properties_mut()
559 }
560
561 pub fn set_shape_properties(&mut self, value: ShapeProperties) -> &mut Self {
562 self.shape_properties = Some(value);
563 self
564 }
565
566 pub fn set_grouping(&mut self, value: GroupingValues) -> &mut Self {
567 if let Some(chart) = &mut self.line_chart {
568 chart.grouping_mut().set_val(value);
569 return self;
570 }
571 if let Some(chart) = &mut self.line_3d_chart {
572 chart.grouping_mut().set_val(value);
573 return self;
574 }
575 if let Some(chart) = &mut self.bar_chart {
576 chart.grouping_mut().set_val(value);
577 return self;
578 }
579 if let Some(chart) = &mut self.bar_3d_chart {
580 chart.grouping_mut().set_val(value);
581 return self;
582 }
583 if let Some(chart) = &mut self.area_chart {
584 chart.grouping_mut().set_val(value);
585 return self;
586 }
587 if let Some(chart) = &mut self.area_3d_chart {
588 chart.grouping_mut().set_val(value);
589 return self;
590 }
591 panic! {"Non-Grouping."};
592 }
593
594 pub fn area_chart_series_list_mut(&mut self) -> &mut AreaChartSeriesList {
595 if let Some(chart) = &mut self.line_chart {
596 return chart.area_chart_series_list_mut();
597 }
598 if let Some(chart) = &mut self.line_3d_chart {
599 return chart.area_chart_series_list_mut();
600 }
601 if let Some(chart) = &mut self.pie_chart {
602 return chart.area_chart_series_list_mut();
603 }
604 if let Some(chart) = &mut self.pie_3d_chart {
605 return chart.area_chart_series_list_mut();
606 }
607 if let Some(chart) = &mut self.doughnut_chart {
608 return chart.area_chart_series_list_mut();
609 }
610 if let Some(chart) = &mut self.scatter_chart {
611 return chart.area_chart_series_list_mut();
612 }
613 if let Some(chart) = &mut self.bar_chart {
614 return chart.area_chart_series_list_mut();
615 }
616 if let Some(chart) = &mut self.bar_3d_chart {
617 return chart.area_chart_series_list_mut();
618 }
619 if let Some(chart) = &mut self.radar_chart {
620 return chart.area_chart_series_list_mut();
621 }
622 if let Some(chart) = &mut self.bubble_chart {
623 return chart.area_chart_series_list_mut();
624 }
625 if let Some(chart) = &mut self.area_chart {
626 return chart.area_chart_series_list_mut();
627 }
628 if let Some(chart) = &mut self.area_3d_chart {
629 return chart.area_chart_series_list_mut();
630 }
631 if let Some(chart) = &mut self.of_pie_chart {
632 return chart.area_chart_series_list_mut();
633 }
634 panic! {"Non-ChartSeriesList."};
635 }
636
637 #[deprecated(since = "3.0.0", note = "Use area_chart_series_list_mut()")]
638 pub fn get_area_chart_series_list_mut(&mut self) -> &mut AreaChartSeriesList {
639 self.area_chart_series_list_mut()
640 }
641
642 pub fn formula_mut(&mut self) -> Vec<&mut Formula> {
643 let mut result: Vec<&mut Formula> = Vec::default();
644 if let Some(v) = &mut self.line_chart {
645 for ser in v.area_chart_series_list_mut().area_chart_series_mut() {
646 for formula in ser.formula_mut() {
647 result.push(formula);
648 }
649 }
650 }
651 if let Some(v) = &mut self.line_3d_chart {
652 for ser in v.area_chart_series_list_mut().area_chart_series_mut() {
653 for formula in ser.formula_mut() {
654 result.push(formula);
655 }
656 }
657 }
658 if let Some(v) = &mut self.pie_chart {
659 for ser in v.area_chart_series_list_mut().area_chart_series_mut() {
660 for formula in ser.formula_mut() {
661 result.push(formula);
662 }
663 }
664 }
665 if let Some(v) = &mut self.pie_3d_chart {
666 for ser in v.area_chart_series_list_mut().area_chart_series_mut() {
667 for formula in ser.formula_mut() {
668 result.push(formula);
669 }
670 }
671 }
672 if let Some(v) = &mut self.doughnut_chart {
673 for ser in v.area_chart_series_list_mut().area_chart_series_mut() {
674 for formula in ser.formula_mut() {
675 result.push(formula);
676 }
677 }
678 }
679 if let Some(v) = &mut self.scatter_chart {
680 for ser in v.area_chart_series_list_mut().area_chart_series_mut() {
681 for formula in ser.formula_mut() {
682 result.push(formula);
683 }
684 }
685 }
686 if let Some(v) = &mut self.bar_chart {
687 for ser in v.area_chart_series_list_mut().area_chart_series_mut() {
688 for formula in ser.formula_mut() {
689 result.push(formula);
690 }
691 }
692 }
693 if let Some(v) = &mut self.bar_3d_chart {
694 for ser in v.area_chart_series_list_mut().area_chart_series_mut() {
695 for formula in ser.formula_mut() {
696 result.push(formula);
697 }
698 }
699 }
700 if let Some(v) = &mut self.radar_chart {
701 for ser in v.area_chart_series_list_mut().area_chart_series_mut() {
702 for formula in ser.formula_mut() {
703 result.push(formula);
704 }
705 }
706 }
707 if let Some(v) = &mut self.bubble_chart {
708 for ser in v.area_chart_series_list_mut().area_chart_series_mut() {
709 for formula in ser.formula_mut() {
710 result.push(formula);
711 }
712 }
713 }
714 if let Some(v) = &mut self.area_chart {
715 for ser in v.area_chart_series_list_mut().area_chart_series_mut() {
716 for formula in ser.formula_mut() {
717 result.push(formula);
718 }
719 }
720 }
721 if let Some(v) = &mut self.area_3d_chart {
722 for ser in v.area_chart_series_list_mut().area_chart_series_mut() {
723 for formula in ser.formula_mut() {
724 result.push(formula);
725 }
726 }
727 }
728 if let Some(v) = &mut self.of_pie_chart {
729 for ser in v.area_chart_series_list_mut().area_chart_series_mut() {
730 for formula in ser.formula_mut() {
731 result.push(formula);
732 }
733 }
734 }
735 result
736 }
737
738 #[deprecated(since = "3.0.0", note = "Use formula_mut()")]
739 pub fn get_formula_mut(&mut self) -> Vec<&mut Formula> {
740 self.formula_mut()
741 }
742
743 pub(crate) fn is_support(&self) -> bool {
744 self.line_chart.is_some()
745 || self.line_3d_chart.is_some()
746 || self.pie_chart.is_some()
747 || self.pie_3d_chart.is_some()
748 || self.doughnut_chart.is_some()
749 || self.scatter_chart.is_some()
750 || self.bar_chart.is_some()
751 || self.bar_3d_chart.is_some()
752 || self.radar_chart.is_some()
753 || self.bubble_chart.is_some()
754 || self.area_chart.is_some()
755 || self.area_3d_chart.is_some()
756 || self.of_pie_chart.is_some()
757 }
758
759 pub(crate) fn set_attributes<R: std::io::BufRead>(
760 &mut self,
761 reader: &mut Reader<R>,
762 _e: &BytesStart,
763 ) {
764 xml_read_loop!(
765 reader,
766 Event::Start(ref e) => match e.name().0 {
767 b"c:layout" => {
768 self.layout.set_attributes(reader, e, false);
769 }
770 b"c:lineChart" => {
771 let mut obj = LineChart::default();
772 obj.set_attributes(reader, e);
773 self.set_line_chart(obj);
774 }
775 b"c:line3DChart" => {
776 let mut obj = Line3DChart::default();
777 obj.set_attributes(reader, e);
778 self.set_line_3d_chart(obj);
779 }
780 b"c:pieChart" => {
781 let mut obj = PieChart::default();
782 obj.set_attributes(reader, e);
783 self.set_pie_chart(obj);
784 }
785 b"c:pie3DChart" => {
786 let mut obj = Pie3DChart::default();
787 obj.set_attributes(reader, e);
788 self.set_pie_3d_chart(obj);
789 }
790 b"c:doughnutChart" => {
791 let mut obj = DoughnutChart::default();
792 obj.set_attributes(reader, e);
793 self.set_doughnut_chart(obj);
794 }
795 b"c:scatterChart" => {
796 let mut obj = ScatterChart::default();
797 obj.set_attributes(reader, e);
798 self.set_scatter_chart(obj);
799 }
800 b"c:barChart" => {
801 let mut obj = BarChart::default();
802 obj.set_attributes(reader, e);
803 self.set_bar_chart(obj);
804 }
805 b"c:bar3DChart" => {
806 let mut obj = Bar3DChart::default();
807 obj.set_attributes(reader, e);
808 self.set_bar_3d_chart(obj);
809 }
810 b"c:radarChart" => {
811 let mut obj = RadarChart::default();
812 obj.set_attributes(reader, e);
813 self.set_radar_chart(obj);
814 }
815 b"c:bubbleChart" => {
816 let mut obj = BubbleChart::default();
817 obj.set_attributes(reader, e);
818 self.set_bubble_chart(obj);
819 }
820 b"c:areaChart" => {
821 let mut obj = AreaChart::default();
822 obj.set_attributes(reader, e);
823 self.set_area_chart(obj);
824 }
825 b"c:area3DChart" => {
826 let mut obj = Area3DChart::default();
827 obj.set_attributes(reader, e);
828 self.set_area_3d_chart(obj);
829 }
830 b"c:ofPieChart" => {
831 let mut obj = OfPieChart::default();
832 obj.set_attributes(reader, e);
833 self.set_of_pie_chart(obj);
834 }
835 b"c:catAx" => {
836 let mut obj = CategoryAxis::default();
837 obj.set_attributes(reader, e);
838 self.add_category_axis(obj);
839 }
840 b"c:dateAx" => {
841 let mut obj = DateAxis::default();
842 obj.set_attributes(reader, e);
843 self.add_date_axis(obj);
844 }
845 b"c:valAx" => {
846 let mut obj = ValueAxis::default();
847 obj.set_attributes(reader, e);
848 self.add_value_axis(obj);
849 }
850 b"c:serAx" => {
851 let mut obj = SeriesAxis::default();
852 obj.set_attributes(reader, e);
853 self.add_series_axis(obj);
854 }
855 b"c:spPr" => {
856 let mut obj = ShapeProperties::default();
857 obj.set_attributes(reader, e);
858 self.set_shape_properties(obj);
859 }
860 _ => (),
861 },
862 Event::End(ref e) => {
863 if e.name().0 == b"c:plotArea" {
864 return;
865 }
866 },
867 Event::Eof => panic!("Error: Could not find {} end element", "c:plotArea"),
868 );
869 }
870
871 pub(crate) fn write_to(&self, writer: &mut Writer<Cursor<Vec<u8>>>, wb: &Workbook) {
872 write_start_tag(writer, "c:plotArea", vec![], false);
874
875 self.layout.write_to(writer);
877
878 if let Some(v) = &self.line_chart {
880 v.write_to(writer, wb);
881 }
882
883 if let Some(v) = &self.line_3d_chart {
885 v.write_to(writer, wb);
886 }
887
888 if let Some(v) = &self.pie_chart {
890 v.write_to(writer, wb);
891 }
892
893 if let Some(v) = &self.pie_3d_chart {
895 v.write_to(writer, wb);
896 }
897
898 if let Some(v) = &self.doughnut_chart {
900 v.write_to(writer, wb);
901 }
902
903 if let Some(v) = &self.scatter_chart {
905 v.write_to(writer, wb);
906 }
907
908 if let Some(v) = &self.bar_chart {
910 v.write_to(writer, wb);
911 }
912
913 if let Some(v) = &self.bar_3d_chart {
915 v.write_to(writer, wb);
916 }
917
918 if let Some(v) = &self.radar_chart {
920 v.write_to(writer, wb);
921 }
922
923 if let Some(v) = &self.bubble_chart {
925 v.write_to(writer, wb);
926 }
927
928 if let Some(v) = &self.area_chart {
930 v.write_to(writer, wb);
931 }
932
933 if let Some(v) = &self.area_3d_chart {
935 v.write_to(writer, wb);
936 }
937
938 if let Some(v) = &self.of_pie_chart {
940 v.write_to(writer, wb);
941 }
942
943 for v in &self.category_axis {
945 v.write_to(writer, wb);
946 }
947
948 for v in &self.date_axis {
950 v.write_to(writer, wb);
951 }
952
953 for v in &self.value_axis {
955 v.write_to(writer, wb);
956 }
957
958 for v in &self.series_axis {
960 v.write_to(writer, wb);
961 }
962
963 if let Some(v) = &self.shape_properties {
965 v.write_to(writer);
966 }
967
968 write_end_tag(writer, "c:plotArea");
969 }
970}
971impl AdjustmentCoordinateWithSheet for PlotArea {
972 fn adjustment_insert_coordinate_with_sheet(
973 &mut self,
974 sheet_name: &str,
975 root_col_num: u32,
976 offset_col_num: u32,
977 root_row_num: u32,
978 offset_row_num: u32,
979 ) {
980 for formula in self.formula_mut() {
981 formula.adjustment_insert_coordinate_with_sheet(
982 sheet_name,
983 root_col_num,
984 offset_col_num,
985 root_row_num,
986 offset_row_num,
987 );
988 }
989 }
990
991 fn adjustment_remove_coordinate_with_sheet(
992 &mut self,
993 sheet_name: &str,
994 root_col_num: u32,
995 offset_col_num: u32,
996 root_row_num: u32,
997 offset_row_num: u32,
998 ) {
999 for formula in self.formula_mut() {
1000 formula.adjustment_remove_coordinate_with_sheet(
1001 sheet_name,
1002 root_col_num,
1003 offset_col_num,
1004 root_row_num,
1005 offset_row_num,
1006 );
1007 }
1008 }
1009}