forked from qax-os/excelize
-
Notifications
You must be signed in to change notification settings - Fork 1
/
chart.go
1213 lines (1196 loc) · 39.9 KB
/
chart.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
// Copyright 2016 - 2024 The excelize Authors. All rights reserved. Use of
// this source code is governed by a BSD-style license that can be found in
// the LICENSE file.
//
// Package excelize providing a set of functions that allow you to write to and
// read from XLAM / XLSM / XLSX / XLTM / XLTX files. Supports reading and
// writing spreadsheet documents generated by Microsoft Excel™ 2007 and later.
// Supports complex components by high compatibility, and provided streaming
// API for generating or reading data from a worksheet with huge amounts of
// data. This library needs Go version 1.18 or later.
package excelize
import (
"encoding/xml"
"fmt"
"strconv"
"strings"
)
// ChartType is the type of supported chart types.
type ChartType byte
// This section defines the currently supported chart types enumeration.
const (
Area ChartType = iota
AreaStacked
AreaPercentStacked
Area3D
Area3DStacked
Area3DPercentStacked
Bar
BarStacked
BarPercentStacked
Bar3DClustered
Bar3DStacked
Bar3DPercentStacked
Bar3DConeClustered
Bar3DConeStacked
Bar3DConePercentStacked
Bar3DPyramidClustered
Bar3DPyramidStacked
Bar3DPyramidPercentStacked
Bar3DCylinderClustered
Bar3DCylinderStacked
Bar3DCylinderPercentStacked
Col
ColStacked
ColPercentStacked
Col3D
Col3DClustered
Col3DStacked
Col3DPercentStacked
Col3DCone
Col3DConeClustered
Col3DConeStacked
Col3DConePercentStacked
Col3DPyramid
Col3DPyramidClustered
Col3DPyramidStacked
Col3DPyramidPercentStacked
Col3DCylinder
Col3DCylinderClustered
Col3DCylinderStacked
Col3DCylinderPercentStacked
Doughnut
Line
Line3D
Pie
Pie3D
PieOfPie
BarOfPie
Radar
Scatter
Surface3D
WireframeSurface3D
Contour
WireframeContour
Bubble
Bubble3D
)
// ChartLineType is the type of supported chart line types.
type ChartLineType byte
// This section defines the currently supported chart line types enumeration.
const (
ChartLineUnset ChartLineType = iota
ChartLineSolid
ChartLineNone
ChartLineAutomatic
)
// ChartTickLabelPositionType is the type of supported chart tick label position
// types.
type ChartTickLabelPositionType byte
// This section defines the supported chart tick label position types
// enumeration.
const (
ChartTickLabelNextToAxis ChartTickLabelPositionType = iota
ChartTickLabelHigh
ChartTickLabelLow
ChartTickLabelNone
)
// This section defines the default value of chart properties.
var (
chartView3DRotX = map[ChartType]int{
Area: 0,
AreaStacked: 0,
AreaPercentStacked: 0,
Area3D: 15,
Area3DStacked: 15,
Area3DPercentStacked: 15,
Bar: 0,
BarStacked: 0,
BarPercentStacked: 0,
Bar3DClustered: 15,
Bar3DStacked: 15,
Bar3DPercentStacked: 15,
Bar3DConeClustered: 15,
Bar3DConeStacked: 15,
Bar3DConePercentStacked: 15,
Bar3DPyramidClustered: 15,
Bar3DPyramidStacked: 15,
Bar3DPyramidPercentStacked: 15,
Bar3DCylinderClustered: 15,
Bar3DCylinderStacked: 15,
Bar3DCylinderPercentStacked: 15,
Col: 0,
ColStacked: 0,
ColPercentStacked: 0,
Col3D: 15,
Col3DClustered: 15,
Col3DStacked: 15,
Col3DPercentStacked: 15,
Col3DCone: 15,
Col3DConeClustered: 15,
Col3DConeStacked: 15,
Col3DConePercentStacked: 15,
Col3DPyramid: 15,
Col3DPyramidClustered: 15,
Col3DPyramidStacked: 15,
Col3DPyramidPercentStacked: 15,
Col3DCylinder: 15,
Col3DCylinderClustered: 15,
Col3DCylinderStacked: 15,
Col3DCylinderPercentStacked: 15,
Doughnut: 0,
Line: 0,
Line3D: 20,
Pie: 0,
Pie3D: 30,
PieOfPie: 0,
BarOfPie: 0,
Radar: 0,
Scatter: 0,
Surface3D: 15,
WireframeSurface3D: 15,
Contour: 90,
WireframeContour: 90,
}
chartView3DRotY = map[ChartType]int{
Area: 0,
AreaStacked: 0,
AreaPercentStacked: 0,
Area3D: 20,
Area3DStacked: 20,
Area3DPercentStacked: 20,
Bar: 0,
BarStacked: 0,
BarPercentStacked: 0,
Bar3DClustered: 20,
Bar3DStacked: 20,
Bar3DPercentStacked: 20,
Bar3DConeClustered: 20,
Bar3DConeStacked: 20,
Bar3DConePercentStacked: 20,
Bar3DPyramidClustered: 20,
Bar3DPyramidStacked: 20,
Bar3DPyramidPercentStacked: 20,
Bar3DCylinderClustered: 20,
Bar3DCylinderStacked: 20,
Bar3DCylinderPercentStacked: 20,
Col: 0,
ColStacked: 0,
ColPercentStacked: 0,
Col3D: 20,
Col3DClustered: 20,
Col3DStacked: 20,
Col3DPercentStacked: 20,
Col3DCone: 20,
Col3DConeClustered: 20,
Col3DConeStacked: 20,
Col3DConePercentStacked: 20,
Col3DPyramid: 20,
Col3DPyramidClustered: 20,
Col3DPyramidStacked: 20,
Col3DPyramidPercentStacked: 20,
Col3DCylinder: 20,
Col3DCylinderClustered: 20,
Col3DCylinderStacked: 20,
Col3DCylinderPercentStacked: 20,
Doughnut: 0,
Line: 0,
Line3D: 15,
Pie: 0,
Pie3D: 0,
PieOfPie: 0,
BarOfPie: 0,
Radar: 0,
Scatter: 0,
Surface3D: 20,
WireframeSurface3D: 20,
Contour: 0,
WireframeContour: 0,
}
plotAreaChartOverlap = map[ChartType]int{
BarStacked: 100,
BarPercentStacked: 100,
ColStacked: 100,
ColPercentStacked: 100,
}
chartView3DPerspective = map[ChartType]int{
Line3D: 30,
Contour: 0,
WireframeContour: 0,
}
chartView3DRAngAx = map[ChartType]int{
Area: 0,
AreaStacked: 0,
AreaPercentStacked: 0,
Area3D: 1,
Area3DStacked: 1,
Area3DPercentStacked: 1,
Bar: 0,
BarStacked: 0,
BarPercentStacked: 0,
Bar3DClustered: 1,
Bar3DStacked: 1,
Bar3DPercentStacked: 1,
Bar3DConeClustered: 1,
Bar3DConeStacked: 1,
Bar3DConePercentStacked: 1,
Bar3DPyramidClustered: 1,
Bar3DPyramidStacked: 1,
Bar3DPyramidPercentStacked: 1,
Bar3DCylinderClustered: 1,
Bar3DCylinderStacked: 1,
Bar3DCylinderPercentStacked: 1,
Col: 0,
ColStacked: 0,
ColPercentStacked: 0,
Col3D: 1,
Col3DClustered: 1,
Col3DStacked: 1,
Col3DPercentStacked: 1,
Col3DCone: 1,
Col3DConeClustered: 1,
Col3DConeStacked: 1,
Col3DConePercentStacked: 1,
Col3DPyramid: 1,
Col3DPyramidClustered: 1,
Col3DPyramidStacked: 1,
Col3DPyramidPercentStacked: 1,
Col3DCylinder: 1,
Col3DCylinderClustered: 1,
Col3DCylinderStacked: 1,
Col3DCylinderPercentStacked: 1,
Doughnut: 0,
Line: 0,
Line3D: 0,
Pie: 0,
Pie3D: 0,
PieOfPie: 0,
BarOfPie: 0,
Radar: 0,
Scatter: 0,
Surface3D: 0,
WireframeSurface3D: 0,
Contour: 0,
Bubble: 0,
Bubble3D: 0,
}
chartLegendPosition = map[string]string{
"bottom": "b",
"left": "l",
"right": "r",
"top": "t",
"top_right": "tr",
}
chartValAxNumFmtFormatCode = map[ChartType]string{
Area: "General",
AreaStacked: "General",
AreaPercentStacked: "0%",
Area3D: "General",
Area3DStacked: "General",
Area3DPercentStacked: "0%",
Bar: "General",
BarStacked: "General",
BarPercentStacked: "0%",
Bar3DClustered: "General",
Bar3DStacked: "General",
Bar3DPercentStacked: "0%",
Bar3DConeClustered: "General",
Bar3DConeStacked: "General",
Bar3DConePercentStacked: "0%",
Bar3DPyramidClustered: "General",
Bar3DPyramidStacked: "General",
Bar3DPyramidPercentStacked: "0%",
Bar3DCylinderClustered: "General",
Bar3DCylinderStacked: "General",
Bar3DCylinderPercentStacked: "0%",
Col: "General",
ColStacked: "General",
ColPercentStacked: "0%",
Col3D: "General",
Col3DClustered: "General",
Col3DStacked: "General",
Col3DPercentStacked: "0%",
Col3DCone: "General",
Col3DConeClustered: "General",
Col3DConeStacked: "General",
Col3DConePercentStacked: "0%",
Col3DPyramid: "General",
Col3DPyramidClustered: "General",
Col3DPyramidStacked: "General",
Col3DPyramidPercentStacked: "0%",
Col3DCylinder: "General",
Col3DCylinderClustered: "General",
Col3DCylinderStacked: "General",
Col3DCylinderPercentStacked: "0%",
Doughnut: "General",
Line: "General",
Line3D: "General",
Pie: "General",
Pie3D: "General",
PieOfPie: "General",
BarOfPie: "General",
Radar: "General",
Scatter: "General",
Surface3D: "General",
WireframeSurface3D: "General",
Contour: "General",
WireframeContour: "General",
Bubble: "General",
Bubble3D: "General",
}
chartValAxCrossBetween = map[ChartType]string{
Area: "midCat",
AreaStacked: "midCat",
AreaPercentStacked: "midCat",
Area3D: "midCat",
Area3DStacked: "midCat",
Area3DPercentStacked: "midCat",
Bar: "between",
BarStacked: "between",
BarPercentStacked: "between",
Bar3DClustered: "between",
Bar3DStacked: "between",
Bar3DPercentStacked: "between",
Bar3DConeClustered: "between",
Bar3DConeStacked: "between",
Bar3DConePercentStacked: "between",
Bar3DPyramidClustered: "between",
Bar3DPyramidStacked: "between",
Bar3DPyramidPercentStacked: "between",
Bar3DCylinderClustered: "between",
Bar3DCylinderStacked: "between",
Bar3DCylinderPercentStacked: "between",
Col: "between",
ColStacked: "between",
ColPercentStacked: "between",
Col3D: "between",
Col3DClustered: "between",
Col3DStacked: "between",
Col3DPercentStacked: "between",
Col3DCone: "between",
Col3DConeClustered: "between",
Col3DConeStacked: "between",
Col3DConePercentStacked: "between",
Col3DPyramid: "between",
Col3DPyramidClustered: "between",
Col3DPyramidStacked: "between",
Col3DPyramidPercentStacked: "between",
Col3DCylinder: "between",
Col3DCylinderClustered: "between",
Col3DCylinderStacked: "between",
Col3DCylinderPercentStacked: "between",
Doughnut: "between",
Line: "between",
Line3D: "between",
Pie: "between",
Pie3D: "between",
PieOfPie: "between",
BarOfPie: "between",
Radar: "between",
Scatter: "between",
Surface3D: "midCat",
WireframeSurface3D: "midCat",
Contour: "midCat",
WireframeContour: "midCat",
Bubble: "midCat",
Bubble3D: "midCat",
}
plotAreaChartGrouping = map[ChartType]string{
Area: "standard",
AreaStacked: "stacked",
AreaPercentStacked: "percentStacked",
Area3D: "standard",
Area3DStacked: "stacked",
Area3DPercentStacked: "percentStacked",
Bar: "clustered",
BarStacked: "stacked",
BarPercentStacked: "percentStacked",
Bar3DClustered: "clustered",
Bar3DStacked: "stacked",
Bar3DPercentStacked: "percentStacked",
Bar3DConeClustered: "clustered",
Bar3DConeStacked: "stacked",
Bar3DConePercentStacked: "percentStacked",
Bar3DPyramidClustered: "clustered",
Bar3DPyramidStacked: "stacked",
Bar3DPyramidPercentStacked: "percentStacked",
Bar3DCylinderClustered: "clustered",
Bar3DCylinderStacked: "stacked",
Bar3DCylinderPercentStacked: "percentStacked",
Col: "clustered",
ColStacked: "stacked",
ColPercentStacked: "percentStacked",
Col3D: "standard",
Col3DClustered: "clustered",
Col3DStacked: "stacked",
Col3DPercentStacked: "percentStacked",
Col3DCone: "standard",
Col3DConeClustered: "clustered",
Col3DConeStacked: "stacked",
Col3DConePercentStacked: "percentStacked",
Col3DPyramid: "standard",
Col3DPyramidClustered: "clustered",
Col3DPyramidStacked: "stacked",
Col3DPyramidPercentStacked: "percentStacked",
Col3DCylinder: "standard",
Col3DCylinderClustered: "clustered",
Col3DCylinderStacked: "stacked",
Col3DCylinderPercentStacked: "percentStacked",
Line: "standard",
Line3D: "standard",
}
plotAreaChartBarDir = map[ChartType]string{
Bar: "bar",
BarStacked: "bar",
BarPercentStacked: "bar",
Bar3DClustered: "bar",
Bar3DStacked: "bar",
Bar3DPercentStacked: "bar",
Bar3DConeClustered: "bar",
Bar3DConeStacked: "bar",
Bar3DConePercentStacked: "bar",
Bar3DPyramidClustered: "bar",
Bar3DPyramidStacked: "bar",
Bar3DPyramidPercentStacked: "bar",
Bar3DCylinderClustered: "bar",
Bar3DCylinderStacked: "bar",
Bar3DCylinderPercentStacked: "bar",
Col: "col",
ColStacked: "col",
ColPercentStacked: "col",
Col3D: "col",
Col3DClustered: "col",
Col3DStacked: "col",
Col3DPercentStacked: "col",
Col3DCone: "col",
Col3DConeStacked: "col",
Col3DConeClustered: "col",
Col3DConePercentStacked: "col",
Col3DPyramid: "col",
Col3DPyramidClustered: "col",
Col3DPyramidStacked: "col",
Col3DPyramidPercentStacked: "col",
Col3DCylinder: "col",
Col3DCylinderClustered: "col",
Col3DCylinderStacked: "col",
Col3DCylinderPercentStacked: "col",
Line: "standard",
Line3D: "standard",
}
orientation = map[bool]string{
true: "maxMin",
false: "minMax",
}
catAxPos = map[bool]string{
true: "t",
false: "b",
}
valAxPos = map[bool]string{
true: "r",
false: "l",
}
tickLblPosVal = map[ChartTickLabelPositionType]string{
ChartTickLabelNextToAxis: "nextTo",
ChartTickLabelHigh: "high",
ChartTickLabelLow: "low",
ChartTickLabelNone: "none",
}
tickLblPosNone = map[ChartType]string{
Contour: "none",
WireframeContour: "none",
}
)
// parseChartOptions provides a function to parse the format settings of the
// chart with default value.
func parseChartOptions(opts *Chart) (*Chart, error) {
if opts == nil {
return nil, ErrParameterInvalid
}
if opts.Dimension.Width == 0 {
opts.Dimension.Width = defaultChartDimensionWidth
}
if opts.Dimension.Height == 0 {
opts.Dimension.Height = defaultChartDimensionHeight
}
if opts.Format.PrintObject == nil {
opts.Format.PrintObject = boolPtr(true)
}
if opts.Format.Locked == nil {
opts.Format.Locked = boolPtr(false)
}
if opts.Format.ScaleX == 0 {
opts.Format.ScaleX = defaultDrawingScale
}
if opts.Format.ScaleY == 0 {
opts.Format.ScaleY = defaultDrawingScale
}
if opts.Legend.Position == "" {
opts.Legend.Position = defaultChartLegendPosition
}
opts.parseTitle()
if opts.VaryColors == nil {
opts.VaryColors = boolPtr(true)
}
if opts.Border.Width == 0 {
opts.Border.Width = 0.75
}
if opts.ShowBlanksAs == "" {
opts.ShowBlanksAs = defaultChartShowBlanksAs
}
return opts, nil
}
// parseTitle parse the title settings of the chart with default value.
func (opts *Chart) parseTitle() {
for i := range opts.Title {
if opts.Title[i].Font == nil {
opts.Title[i].Font = &Font{}
}
if opts.Title[i].Font.Color == "" {
opts.Title[i].Font.Color = "595959"
}
if opts.Title[i].Font.Size == 0 {
opts.Title[i].Font.Size = 14
}
}
}
// AddChart provides the method to add chart in a sheet by given chart format
// set (such as offset, scale, aspect ratio setting and print settings) and
// properties set. For example, create 3D clustered column chart with data
// Sheet1!$E$1:$L$15:
//
// package main
//
// import (
// "fmt"
//
// "github.com/xuri/excelize/v2"
// )
//
// func main() {
// f := excelize.NewFile()
// defer func() {
// if err := f.Close(); err != nil {
// fmt.Println(err)
// }
// }()
// for idx, row := range [][]interface{}{
// {nil, "Apple", "Orange", "Pear"}, {"Small", 2, 3, 3},
// {"Normal", 5, 2, 4}, {"Large", 6, 7, 8},
// } {
// cell, err := excelize.CoordinatesToCellName(1, idx+1)
// if err != nil {
// fmt.Println(err)
// return
// }
// f.SetSheetRow("Sheet1", cell, &row)
// }
// if err := f.AddChart("Sheet1", "E1", &excelize.Chart{
// Type: excelize.Col3DClustered,
// Series: []excelize.ChartSeries{
// {
// Name: "Sheet1!$A$2",
// Categories: "Sheet1!$B$1:$D$1",
// Values: "Sheet1!$B$2:$D$2",
// },
// {
// Name: "Sheet1!$A$3",
// Categories: "Sheet1!$B$1:$D$1",
// Values: "Sheet1!$B$3:$D$3",
// },
// {
// Name: "Sheet1!$A$4",
// Categories: "Sheet1!$B$1:$D$1",
// Values: "Sheet1!$B$4:$D$4",
// },
// },
// Title: []excelize.RichTextRun{
// {
// Text: "Fruit 3D Clustered Column Chart",
// },
// },
// Legend: excelize.ChartLegend{
// ShowLegendKey: false,
// },
// PlotArea: excelize.ChartPlotArea{
// ShowBubbleSize: true,
// ShowCatName: false,
// ShowLeaderLines: false,
// ShowPercent: true,
// ShowSerName: true,
// ShowVal: true,
// },
// }); err != nil {
// fmt.Println(err)
// return
// }
// // Save spreadsheet by the given path.
// if err := f.SaveAs("Book1.xlsx"); err != nil {
// fmt.Println(err)
// }
// }
//
// The following shows the type of chart supported by excelize:
//
// ID | Enumeration | Chart
// ----+-----------------------------+------------------------------
// 0 | Area | 2D area chart
// 1 | AreaStacked | 2D stacked area chart
// 2 | AreaPercentStacked | 2D 100% stacked area chart
// 3 | Area3D | 3D area chart
// 4 | Area3DStacked | 3D stacked area chart
// 5 | Area3DPercentStacked | 3D 100% stacked area chart
// 6 | Bar | 2D clustered bar chart
// 7 | BarStacked | 2D stacked bar chart
// 8 | BarPercentStacked | 2D 100% stacked bar chart
// 9 | Bar3DClustered | 3D clustered bar chart
// 10 | Bar3DStacked | 3D stacked bar chart
// 11 | Bar3DPercentStacked | 3D 100% stacked bar chart
// 12 | Bar3DConeClustered | 3D cone clustered bar chart
// 13 | Bar3DConeStacked | 3D cone stacked bar chart
// 14 | Bar3DConePercentStacked | 3D cone percent bar chart
// 15 | Bar3DPyramidClustered | 3D pyramid clustered bar chart
// 16 | Bar3DPyramidStacked | 3D pyramid stacked bar chart
// 17 | Bar3DPyramidPercentStacked | 3D pyramid percent stacked bar chart
// 18 | Bar3DCylinderClustered | 3D cylinder clustered bar chart
// 19 | Bar3DCylinderStacked | 3D cylinder stacked bar chart
// 20 | Bar3DCylinderPercentStacked | 3D cylinder percent stacked bar chart
// 21 | Col | 2D clustered column chart
// 22 | ColStacked | 2D stacked column chart
// 23 | ColPercentStacked | 2D 100% stacked column chart
// 24 | Col3DClustered | 3D clustered column chart
// 25 | Col3D | 3D column chart
// 26 | Col3DStacked | 3D stacked column chart
// 27 | Col3DPercentStacked | 3D 100% stacked column chart
// 28 | Col3DCone | 3D cone column chart
// 29 | Col3DConeClustered | 3D cone clustered column chart
// 30 | Col3DConeStacked | 3D cone stacked column chart
// 31 | Col3DConePercentStacked | 3D cone percent stacked column chart
// 32 | Col3DPyramid | 3D pyramid column chart
// 33 | Col3DPyramidClustered | 3D pyramid clustered column chart
// 34 | Col3DPyramidStacked | 3D pyramid stacked column chart
// 35 | Col3DPyramidPercentStacked | 3D pyramid percent stacked column chart
// 36 | Col3DCylinder | 3D cylinder column chart
// 37 | Col3DCylinderClustered | 3D cylinder clustered column chart
// 38 | Col3DCylinderStacked | 3D cylinder stacked column chart
// 39 | Col3DCylinderPercentStacked | 3D cylinder percent stacked column chart
// 40 | Doughnut | doughnut chart
// 41 | Line | line chart
// 42 | Line3D | 3D line chart
// 43 | Pie | pie chart
// 44 | Pie3D | 3D pie chart
// 45 | PieOfPie | pie of pie chart
// 46 | BarOfPie | bar of pie chart
// 47 | Radar | radar chart
// 48 | Scatter | scatter chart
// 49 | Surface3D | 3D surface chart
// 50 | WireframeSurface3D | 3D wireframe surface chart
// 51 | Contour | contour chart
// 52 | WireframeContour | wireframe contour chart
// 53 | Bubble | bubble chart
// 54 | Bubble3D | 3D bubble chart
//
// In Excel a chart series is a collection of information that defines which
// data is plotted such as values, axis labels and formatting.
//
// The series options that can be set are:
//
// Name
// Categories
// Values
// Fill
// Line
// Marker
// DataLabelPosition
//
// Name: Set the name for the series. The name is displayed in the chart legend
// and in the formula bar. The 'Name' property is optional and if it isn't
// supplied it will default to Series 1..n. The name can also be a formula such
// as Sheet1!$A$1
//
// Categories: This sets the chart category labels. The category is more or less
// the same as the X axis. In most chart types the 'Categories' property is
// optional and the chart will just assume a sequential series from 1..n.
//
// Values: This is the most important property of a series and is the only
// mandatory option for every chart object. This option links the chart with
// the worksheet data that it displays.
//
// Sizes: This sets the bubble size in a data series. The 'Sizes' property is
// optional and the default value was same with 'Values'.
//
// Fill: This set the format for the data series fill. The 'Fill' property is
// optional
//
// Line: This sets the line format of the line chart. The 'Line' property is
// optional and if it isn't supplied it will default style. The options that
// can be set are width and color. The range of width is 0.25pt - 999pt. If the
// value of width is outside the range, the default width of the line is 2pt.
//
// Marker: This sets the marker of the line chart and scatter chart. The range
// of optional field 'Size' is 2-72 (default value is 5). The enumeration value
// of optional field 'Symbol' are (default value is 'auto'):
//
// circle
// dash
// diamond
// dot
// none
// picture
// plus
// square
// star
// triangle
// x
// auto
//
// DataLabelPosition: This sets the position of the chart series data label.
//
// Set properties of the chart legend. The options that can be set are:
//
// Position
// ShowLegendKey
//
// Position: Set the position of the chart legend. The default legend position
// is bottom. The available positions are:
//
// none
// top
// bottom
// left
// right
// top_right
//
// ShowLegendKey: Set the legend keys shall be shown in data labels. The default
// value is false.
//
// Set properties of the chart title. The properties that can be set are:
//
// Title
//
// Title: Set the name (title) for the chart. The name is displayed above the
// chart. The name can also be a formula such as Sheet1!$A$1 or a list with a
// sheet name. The name property is optional. The default is to have no chart
// title.
//
// Specifies how blank cells are plotted on the chart by 'ShowBlanksAs'. The
// default value is gap. The options that can be set are:
//
// gap
// span
// zero
//
// gap: Specifies that blank values shall be left as a gap.
//
// span: Specifies that blank values shall be spanned with a line.
//
// zero: Specifies that blank values shall be treated as zero.
//
// Specifies that each data marker in the series has a different color by
// 'VaryColors'. The default value is true.
//
// Set chart offset, scale, aspect ratio setting and print settings by 'Format',
// same as function 'AddPicture'.
//
// Set the position of the chart plot area by 'PlotArea'. The properties that
// can be set are:
//
// SecondPlotValues
// ShowBubbleSize
// ShowCatName
// ShowLeaderLines
// ShowPercent
// ShowSerName
// ShowVal
// NumFmt
//
// SecondPlotValues: Specifies the values in second plot for the 'pieOfPie' and
// 'barOfPie' chart.
//
// ShowBubbleSize: Specifies the bubble size shall be shown in a data label. The
// 'ShowBubbleSize' property is optional. The default value is false.
//
// ShowCatName: Specifies that the category name shall be shown in the data
// label. The 'ShowCatName' property is optional. The default value is true.
//
// ShowLeaderLines: Specifies leader lines shall be shown for data labels. The
// 'ShowLeaderLines' property is optional. The default value is false.
//
// ShowPercent: Specifies that the percentage shall be shown in a data label.
// The 'ShowPercent' property is optional. The default value is false.
//
// ShowSerName: Specifies that the series name shall be shown in a data label.
// The 'ShowSerName' property is optional. The default value is false.
//
// ShowVal: Specifies that the value shall be shown in a data label.
// The 'ShowVal' property is optional. The default value is false.
//
// NumFmt: Specifies that if linked to source and set custom number format code
// for data labels. The 'NumFmt' property is optional. The default format code
// is 'General'.
//
// Set the primary horizontal and vertical axis options by 'XAxis' and 'YAxis'.
// The properties of 'XAxis' that can be set are:
//
// None
// MajorGridLines
// MinorGridLines
// TickLabelSkip
// ReverseOrder
// Maximum
// Minimum
// Alignment
// Font
// NumFmt
// Title
//
// The properties of 'YAxis' that can be set are:
//
// None
// MajorGridLines
// MinorGridLines
// MajorUnit
// Secondary
// ReverseOrder
// Maximum
// Minimum
// Alignment
// Font
// LogBase
// NumFmt
// Title
//
// None: Disable axes.
//
// MajorGridLines: Specifies major grid lines.
//
// MinorGridLines: Specifies minor grid lines.
//
// MajorUnit: Specifies the distance between major ticks. Shall contain a
// positive floating-point number. The 'MajorUnit' property is optional. The
// default value is auto.
//
// Secondary: Specifies the current series vertical axis as the secondary axis,
// this only works for the second and later chart in the combo chart. The
// default value is false.
//
// TickLabelSkip: Specifies how many tick labels to skip between label that is
// drawn. The 'TickLabelSkip' property is optional. The default value is auto.
//
// ReverseOrder: Specifies that the categories or values on reverse order
// (orientation of the chart). The 'ReverseOrder' property is optional. The
// default value is false.
//
// Maximum: Specifies that the fixed maximum, 0 is auto. The 'Maximum' property
// is optional. The default value is auto.
//
// Minimum: Specifies that the fixed minimum, 0 is auto. The 'Minimum' property
// is optional. The default value is auto.
//
// Alignment: Specifies that the alignment of the horizontal and vertical axis.
// The properties of font that can be set are:
//
// TextRotation
// Vertical
//
// The value of 'TextRotation' that can be set from -90 to 90:
//
// The value of 'Vertical' that can be set are:
//
// horz
// vert
// vert270
// wordArtVert
// eaVert
// mongolianVert
// wordArtVertRtl
//
// Font: Specifies that the font of the horizontal and vertical axis. The
// properties of font that can be set are:
//
// Bold
// Italic
// Underline
// Family
// Size
// Strike
// Color
// VertAlign
//
// LogBase: Specifies logarithmic scale base number of the vertical axis.
//
// NumFmt: Specifies that if linked to source and set custom number format code
// for axis. The 'NumFmt' property is optional. The default format code is
// 'General'.
//
// Title: Specifies that the primary horizontal or vertical axis title and
// resize chart. The 'Title' property is optional.
//
// Set chart size by 'Dimension' property. The 'Dimension' property is optional.
// The default width is 480, and height is 260.
//
// Set the bubble size in all data series for the bubble chart or 3D bubble
// chart by 'BubbleSizes' property. The 'BubbleSizes' property is optional. The
// default width is 100, and the value should be great than 0 and less or equal
// than 300.
//
// Set the doughnut hole size in all data series for the doughnut chart by
// 'HoleSize' property. The 'HoleSize' property is optional. The default width
// is 75, and the value should be great than 0 and less or equal than 90.
//
// combo: Specifies the create a chart that combines two or more chart types in
// a single chart. For example, create a clustered column - line chart with
// data Sheet1!$E$1:$L$15:
//
// package main
//
// import (
// "fmt"
//
// "github.com/xuri/excelize/v2"
// )
//
// func main() {
// f := excelize.NewFile()
// defer func() {
// if err := f.Close(); err != nil {
// fmt.Println(err)
// }
// }()
// for idx, row := range [][]interface{}{
// {nil, "Apple", "Orange", "Pear"}, {"Small", 2, 3, 3},
// {"Normal", 5, 2, 4}, {"Large", 6, 7, 8},
// } {
// cell, err := excelize.CoordinatesToCellName(1, idx+1)
// if err != nil {
// fmt.Println(err)
// return
// }
// f.SetSheetRow("Sheet1", cell, &row)
// }
// enable, disable := true, false
// if err := f.AddChart("Sheet1", "E1", &excelize.Chart{
// Type: excelize.Col,
// Series: []excelize.ChartSeries{
// {
// Name: "Sheet1!$A$2",
// Categories: "Sheet1!$B$1:$D$1",
// Values: "Sheet1!$B$2:$D$2",
// },
// },
// Format: excelize.GraphicOptions{
// ScaleX: 1,
// ScaleY: 1,
// OffsetX: 15,
// OffsetY: 10,
// PrintObject: &enable,
// LockAspectRatio: false,
// Locked: &disable,
// },