npoi

Форк
0
/
ScatterChart.cs 
613 строк · 16.5 Кб
1
using NPOI.OpenXml4Net.Util;
2
using System;
3
using System.Collections.Generic;
4
using System.ComponentModel;
5
using System.IO;
6
using System.Text;
7
using System.Xml;
8
using System.Xml.Serialization;
9

10
namespace NPOI.OpenXmlFormats.Dml.Chart
11
{
12

13

14

15
    [Serializable]
16

17
    [System.ComponentModel.DesignerCategoryAttribute("code")]
18
    [XmlType(Namespace = "http://schemas.openxmlformats.org/drawingml/2006/chart")]
19
    [XmlRoot(Namespace = "http://schemas.openxmlformats.org/drawingml/2006/chart", IsNullable = true)]
20
    public class CT_ScatterSer
21
    {
22

23
        private CT_UnsignedInt idxField;
24

25
        private CT_UnsignedInt orderField;
26

27
        private CT_SerTx txField;
28

29
        private CT_ShapeProperties spPrField;
30

31
        private CT_Marker markerField;
32

33
        private List<CT_DPt> dPtField;
34

35
        private CT_DLbls dLblsField;
36

37
        private List<CT_Trendline> trendlineField;
38

39
        private List<CT_ErrBars> errBarsField;
40

41
        private CT_AxDataSource xValField;
42

43
        private CT_NumDataSource yValField;
44

45
        private CT_Boolean smoothField;
46

47
        private List<CT_Extension> extLstField;
48

49
        public CT_ScatterSer()
50
        {
51

52
        }
53
        public static CT_ScatterSer Parse(XmlNode node, XmlNamespaceManager namespaceManager)
54
        {
55
            if (node == null)
56
                return null;
57
            CT_ScatterSer ctObj = new CT_ScatterSer();
58
            ctObj.dPt = new List<CT_DPt>();
59
            ctObj.trendline = new List<CT_Trendline>();
60
            ctObj.errBars = new List<CT_ErrBars>();
61
            ctObj.extLst = new List<CT_Extension>();
62
            foreach (XmlNode childNode in node.ChildNodes)
63
            {
64
                if (childNode.LocalName == "idx")
65
                    ctObj.idx = CT_UnsignedInt.Parse(childNode, namespaceManager);
66
                else if (childNode.LocalName == "order")
67
                    ctObj.order = CT_UnsignedInt.Parse(childNode, namespaceManager);
68
                else if (childNode.LocalName == "tx")
69
                    ctObj.tx = CT_SerTx.Parse(childNode, namespaceManager);
70
                else if (childNode.LocalName == "spPr")
71
                    ctObj.spPr = CT_ShapeProperties.Parse(childNode, namespaceManager);
72
                else if (childNode.LocalName == "marker")
73
                    ctObj.marker = CT_Marker.Parse(childNode, namespaceManager);
74
                else if (childNode.LocalName == "dLbls")
75
                    ctObj.dLbls = CT_DLbls.Parse(childNode, namespaceManager);
76
                else if (childNode.LocalName == "xVal")
77
                    ctObj.xVal = CT_AxDataSource.Parse(childNode, namespaceManager);
78
                else if (childNode.LocalName == "yVal")
79
                    ctObj.yVal = CT_NumDataSource.Parse(childNode, namespaceManager);
80
                else if (childNode.LocalName == "smooth")
81
                    ctObj.smooth = CT_Boolean.Parse(childNode, namespaceManager);
82
                else if (childNode.LocalName == "dPt")
83
                    ctObj.dPt.Add(CT_DPt.Parse(childNode, namespaceManager));
84
                else if (childNode.LocalName == "trendline")
85
                    ctObj.trendline.Add(CT_Trendline.Parse(childNode, namespaceManager));
86
                else if (childNode.LocalName == "errBars")
87
                    ctObj.errBars.Add(CT_ErrBars.Parse(childNode, namespaceManager));
88
                else if (childNode.LocalName == "extLst")
89
                    ctObj.extLst.Add(CT_Extension.Parse(childNode, namespaceManager));
90
            }
91
            return ctObj;
92
        }
93

94

95

96
        internal void Write(StreamWriter sw, string nodeName)
97
        {
98
            sw.Write(string.Format("<c:{0}", nodeName));
99
            sw.Write(">");
100
            if (this.idx != null)
101
                this.idx.Write(sw, "idx");
102
            if (this.order != null)
103
                this.order.Write(sw, "order");
104
            if (this.tx != null)
105
                this.tx.Write(sw, "tx");
106
            if (this.spPr != null)
107
                this.spPr.Write(sw, "spPr");
108
            if (this.marker != null)
109
                this.marker.Write(sw, "marker");
110
            if (this.dLbls != null)
111
                this.dLbls.Write(sw, "dLbls");
112
            if (this.xVal != null)
113
                this.xVal.Write(sw, "xVal");
114
            if (this.yVal != null)
115
                this.yVal.Write(sw, "yVal");
116
            if (this.smooth != null)
117
                this.smooth.Write(sw, "smooth");
118
            if (this.dPt != null)
119
            {
120
                foreach (CT_DPt x in this.dPt)
121
                {
122
                    x.Write(sw, "dPt");
123
                }
124
            }
125
            if (this.trendline != null)
126
            {
127
                foreach (CT_Trendline x in this.trendline)
128
                {
129
                    x.Write(sw, "trendline");
130
                }
131
            }
132
            if (this.errBars != null)
133
            {
134
                foreach (CT_ErrBars x in this.errBars)
135
                {
136
                    x.Write(sw, "errBars");
137
                }
138
            }
139
            if (this.extLst != null)
140
            {
141
                foreach (CT_Extension x in this.extLst)
142
                {
143
                    x.Write(sw, "extLst");
144
                }
145
            }
146
            sw.Write(string.Format("</c:{0}>", nodeName));
147
        }
148

149

150
        public CT_UnsignedInt AddNewIdx()
151
        {
152
            this.idxField = new CT_UnsignedInt();
153
            return idxField;
154
        }
155
        public CT_UnsignedInt AddNewOrder()
156
        {
157
            this.orderField = new CT_UnsignedInt();
158
            return orderField;
159
        }
160
        public CT_AxDataSource AddNewXVal()
161
        {
162
            this.xValField = new CT_AxDataSource();
163
            return this.xValField;
164
        }
165
        public CT_NumDataSource AddNewYVal()
166
        {
167
            this.yValField = new CT_NumDataSource();
168
            return this.yValField;
169
        }
170

171

172
        [XmlElement(Order = 0)]
173
        public CT_UnsignedInt idx
174
        {
175
            get
176
            {
177
                return this.idxField;
178
            }
179
            set
180
            {
181
                this.idxField = value;
182
            }
183
        }
184

185
        [XmlElement(Order = 1)]
186
        public CT_UnsignedInt order
187
        {
188
            get
189
            {
190
                return this.orderField;
191
            }
192
            set
193
            {
194
                this.orderField = value;
195
            }
196
        }
197

198
        [XmlElement(Order = 2)]
199
        public CT_SerTx tx
200
        {
201
            get
202
            {
203
                return this.txField;
204
            }
205
            set
206
            {
207
                this.txField = value;
208
            }
209
        }
210

211
        [XmlElement(Order = 3)]
212
        public CT_ShapeProperties spPr
213
        {
214
            get
215
            {
216
                return this.spPrField;
217
            }
218
            set
219
            {
220
                this.spPrField = value;
221
            }
222
        }
223

224
        [XmlElement(Order = 4)]
225
        public CT_Marker marker
226
        {
227
            get
228
            {
229
                return this.markerField;
230
            }
231
            set
232
            {
233
                this.markerField = value;
234
            }
235
        }
236

237
        [XmlElement("dPt", Order = 5)]
238
        public List<CT_DPt> dPt
239
        {
240
            get
241
            {
242
                return this.dPtField;
243
            }
244
            set
245
            {
246
                this.dPtField = value;
247
            }
248
        }
249

250
        [XmlElement(Order = 6)]
251
        public CT_DLbls dLbls
252
        {
253
            get
254
            {
255
                return this.dLblsField;
256
            }
257
            set
258
            {
259
                this.dLblsField = value;
260
            }
261
        }
262

263
        [XmlElement("trendline", Order = 7)]
264
        public List<CT_Trendline> trendline
265
        {
266
            get
267
            {
268
                return this.trendlineField;
269
            }
270
            set
271
            {
272
                this.trendlineField = value;
273
            }
274
        }
275

276
        [XmlElement("errBars", Order = 8)]
277
        public List<CT_ErrBars> errBars
278
        {
279
            get
280
            {
281
                return this.errBarsField;
282
            }
283
            set
284
            {
285
                this.errBarsField = value;
286
            }
287
        }
288

289
        [XmlElement(Order = 9)]
290
        public CT_AxDataSource xVal
291
        {
292
            get
293
            {
294
                return this.xValField;
295
            }
296
            set
297
            {
298
                this.xValField = value;
299
            }
300
        }
301

302
        [XmlElement(Order = 10)]
303
        public CT_NumDataSource yVal
304
        {
305
            get
306
            {
307
                return this.yValField;
308
            }
309
            set
310
            {
311
                this.yValField = value;
312
            }
313
        }
314

315
        [XmlElement(Order = 11)]
316
        public CT_Boolean smooth
317
        {
318
            get
319
            {
320
                return this.smoothField;
321
            }
322
            set
323
            {
324
                this.smoothField = value;
325
            }
326
        }
327

328
        [XmlElement(Order = 12)]
329
        public List<CT_Extension> extLst
330
        {
331
            get
332
            {
333
                return this.extLstField;
334
            }
335
            set
336
            {
337
                this.extLstField = value;
338
            }
339
        }
340
    }
341

342

343
    [Serializable]
344

345
    [System.ComponentModel.DesignerCategoryAttribute("code")]
346
    [XmlType(Namespace = "http://schemas.openxmlformats.org/drawingml/2006/chart")]
347
    [XmlRoot(Namespace = "http://schemas.openxmlformats.org/drawingml/2006/chart", IsNullable = true)]
348
    public class CT_ScatterStyle
349
    {
350
        public static CT_ScatterStyle Parse(XmlNode node, XmlNamespaceManager namespaceManager)
351
        {
352
            if (node == null)
353
                return null;
354
            CT_ScatterStyle ctObj = new CT_ScatterStyle();
355
            if (node.Attributes["val"] != null)
356
                ctObj.val = (ST_ScatterStyle)Enum.Parse(typeof(ST_ScatterStyle), node.Attributes["val"].Value);
357
            return ctObj;
358
        }
359

360

361

362
        internal void Write(StreamWriter sw, string nodeName)
363
        {
364
            sw.Write(string.Format("<c:{0}", nodeName));
365
            XmlHelper.WriteAttribute(sw, "val", this.val.ToString());
366
            sw.Write(">");
367
            sw.Write(string.Format("</c:{0}>", nodeName));
368
        }
369

370
        private ST_ScatterStyle valField;
371

372
        public CT_ScatterStyle()
373
        {
374
            this.valField = ST_ScatterStyle.marker;
375
        }
376

377
        [XmlAttribute]
378
        [DefaultValue(ST_ScatterStyle.marker)]
379
        public ST_ScatterStyle val
380
        {
381
            get
382
            {
383
                return this.valField;
384
            }
385
            set
386
            {
387
                this.valField = value;
388
            }
389
        }
390
    }
391

392

393
    [Serializable]
394
    [XmlType(Namespace = "http://schemas.openxmlformats.org/drawingml/2006/chart")]
395
    public enum ST_ScatterStyle
396
    {
397

398
        /// <remarks/>
399
        none,
400

401
        /// <remarks/>
402
        line,
403

404
        /// <remarks/>
405
        lineMarker,
406

407
        /// <remarks/>
408
        marker,
409

410
        /// <remarks/>
411
        smooth,
412

413
        /// <remarks/>
414
        smoothMarker,
415
    }
416

417

418
    [Serializable]
419

420
    [System.ComponentModel.DesignerCategoryAttribute("code")]
421
    [XmlType(Namespace = "http://schemas.openxmlformats.org/drawingml/2006/chart")]
422
    [XmlRoot(Namespace = "http://schemas.openxmlformats.org/drawingml/2006/chart", IsNullable = true)]
423
    public class CT_ScatterChart
424
    {
425

426
        private CT_ScatterStyle scatterStyleField;
427

428
        private CT_Boolean varyColorsField;
429

430
        private List<CT_ScatterSer> serField;
431

432
        private CT_DLbls dLblsField;
433

434
        private List<CT_UnsignedInt> axIdField;
435

436
        private List<CT_Extension> extLstField;
437

438
        public CT_ScatterChart()
439
        {
440
            //this.extLstField = new List<CT_Extension>();
441
            //this.dLblsField = new CT_DLbls();
442
            //this.varyColorsField = new CT_Boolean();
443
        }
444
        public static CT_ScatterChart Parse(XmlNode node, XmlNamespaceManager namespaceManager)
445
        {
446
            if (node == null)
447
                return null;
448
            CT_ScatterChart ctObj = new CT_ScatterChart();
449
            ctObj.ser = new List<CT_ScatterSer>();
450
            ctObj.axId = new List<CT_UnsignedInt>();
451
            ctObj.extLst = new List<CT_Extension>();
452
            foreach (XmlNode childNode in node.ChildNodes)
453
            {
454
                if (childNode.LocalName == "scatterStyle")
455
                    ctObj.scatterStyle = CT_ScatterStyle.Parse(childNode, namespaceManager);
456
                else if (childNode.LocalName == "varyColors")
457
                    ctObj.varyColors = CT_Boolean.Parse(childNode, namespaceManager);
458
                else if (childNode.LocalName == "dLbls")
459
                    ctObj.dLbls = CT_DLbls.Parse(childNode, namespaceManager);
460
                else if (childNode.LocalName == "ser")
461
                    ctObj.ser.Add(CT_ScatterSer.Parse(childNode, namespaceManager));
462
                else if (childNode.LocalName == "axId")
463
                    ctObj.axId.Add(CT_UnsignedInt.Parse(childNode, namespaceManager));
464
                else if (childNode.LocalName == "extLst")
465
                    ctObj.extLst.Add(CT_Extension.Parse(childNode, namespaceManager));
466
            }
467
            return ctObj;
468
        }
469

470

471

472
        internal void Write(StreamWriter sw, string nodeName)
473
        {
474
            sw.Write(string.Format("<c:{0}", nodeName));
475
            sw.Write(">");
476
            if (this.scatterStyle != null)
477
                this.scatterStyle.Write(sw, "scatterStyle");
478
            if (this.varyColors != null)
479
                this.varyColors.Write(sw, "varyColors");
480
            if (this.dLbls != null)
481
                this.dLbls.Write(sw, "dLbls");
482
            if (this.ser != null)
483
            {
484
                foreach (CT_ScatterSer x in this.ser)
485
                {
486
                    x.Write(sw, "ser");
487
                }
488
            }
489
            if (this.axId != null)
490
            {
491
                foreach (CT_UnsignedInt x in this.axId)
492
                {
493
                    x.Write(sw, "axId");
494
                }
495
            }
496
            if (this.extLst != null)
497
            {
498
                foreach (CT_Extension x in this.extLst)
499
                {
500
                    x.Write(sw, "extLst");
501
                }
502
            }
503
            sw.Write(string.Format("</c:{0}>", nodeName));
504
        }
505

506
        public CT_ScatterStyle AddNewScatterStyle()
507
        {
508
            this.scatterStyleField = new CT_ScatterStyle();
509
            return scatterStyleField;
510
        }
511
        public CT_UnsignedInt AddNewAxId()
512
        {
513
            if (this.axIdField == null)
514
                this.axIdField = new List<CT_UnsignedInt>();
515
            CT_UnsignedInt axIdItem = new CT_UnsignedInt();
516
            this.axIdField.Add(axIdItem);
517
            return axIdItem;
518
        }
519
        public CT_ScatterSer AddNewSer()
520
        {
521
            if (this.serField == null)
522
                this.serField = new List<CT_ScatterSer>();
523
            CT_ScatterSer ser = new CT_ScatterSer();
524
            this.serField.Add(ser);
525
            return ser;
526
        }
527

528
        public int GetSeriesCount()
529
        {
530
            return this.serField == null ? 0 : this.serField.Count;
531
        }
532

533
        [XmlElement(Order = 0)]
534
        public CT_ScatterStyle scatterStyle
535
        {
536
            get
537
            {
538
                return this.scatterStyleField;
539
            }
540
            set
541
            {
542
                this.scatterStyleField = value;
543
            }
544
        }
545

546
        [XmlElement(Order = 1)]
547
        public CT_Boolean varyColors
548
        {
549
            get
550
            {
551
                return this.varyColorsField;
552
            }
553
            set
554
            {
555
                this.varyColorsField = value;
556
            }
557
        }
558

559
        [XmlElement("ser", Order = 2)]
560
        public List<CT_ScatterSer> ser
561
        {
562
            get
563
            {
564
                return this.serField;
565
            }
566
            set
567
            {
568
                this.serField = value;
569
            }
570
        }
571

572
        [XmlElement(Order = 3)]
573
        public CT_DLbls dLbls
574
        {
575
            get
576
            {
577
                return this.dLblsField;
578
            }
579
            set
580
            {
581
                this.dLblsField = value;
582
            }
583
        }
584

585
        [XmlElement("axId", Order = 4)]
586
        public List<CT_UnsignedInt> axId
587
        {
588
            get
589
            {
590
                return this.axIdField;
591
            }
592
            set
593
            {
594
                this.axIdField = value;
595
            }
596
        }
597

598
        [XmlElement(Order = 5)]
599
        public List<CT_Extension> extLst
600
        {
601
            get
602
            {
603
                return this.extLstField;
604
            }
605
            set
606
            {
607
                this.extLstField = value;
608
            }
609
        }
610
    }
611

612

613
}
614

Использование cookies

Мы используем файлы cookie в соответствии с Политикой конфиденциальности и Политикой использования cookies.

Нажимая кнопку «Принимаю», Вы даете АО «СберТех» согласие на обработку Ваших персональных данных в целях совершенствования нашего веб-сайта и Сервиса GitVerse, а также повышения удобства их использования.

Запретить использование cookies Вы можете самостоятельно в настройках Вашего браузера.