@@ -277,13 +277,10 @@ func (f *File) drawBaseChart(opts *Chart) *cPlotArea {
277
277
VaryColors : & attrValBool {
278
278
Val : opts .VaryColors ,
279
279
},
280
- Ser : f .drawChartSeries (opts ),
281
- Shape : f .drawChartShape (opts ),
282
- DLbls : f .drawChartDLbls (opts ),
283
- AxID : []* attrValInt {
284
- {Val : intPtr (754001152 )},
285
- {Val : intPtr (753999904 )},
286
- },
280
+ Ser : f .drawChartSeries (opts ),
281
+ Shape : f .drawChartShape (opts ),
282
+ DLbls : f .drawChartDLbls (opts ),
283
+ AxID : f .genAxID (opts ),
287
284
Overlap : & attrValInt {Val : intPtr (100 )},
288
285
}
289
286
var ok bool
@@ -542,10 +539,7 @@ func (f *File) drawLineChart(opts *Chart) *cPlotArea {
542
539
},
543
540
Ser : f .drawChartSeries (opts ),
544
541
DLbls : f .drawChartDLbls (opts ),
545
- AxID : []* attrValInt {
546
- {Val : intPtr (754001152 )},
547
- {Val : intPtr (753999904 )},
548
- },
542
+ AxID : f .genAxID (opts ),
549
543
},
550
544
CatAx : f .drawPlotAreaCatAx (opts ),
551
545
ValAx : f .drawPlotAreaValAx (opts ),
@@ -565,10 +559,7 @@ func (f *File) drawLine3DChart(opts *Chart) *cPlotArea {
565
559
},
566
560
Ser : f .drawChartSeries (opts ),
567
561
DLbls : f .drawChartDLbls (opts ),
568
- AxID : []* attrValInt {
569
- {Val : intPtr (754001152 )},
570
- {Val : intPtr (753999904 )},
571
- },
562
+ AxID : f .genAxID (opts ),
572
563
},
573
564
CatAx : f .drawPlotAreaCatAx (opts ),
574
565
ValAx : f .drawPlotAreaValAx (opts ),
@@ -658,10 +649,7 @@ func (f *File) drawRadarChart(opts *Chart) *cPlotArea {
658
649
},
659
650
Ser : f .drawChartSeries (opts ),
660
651
DLbls : f .drawChartDLbls (opts ),
661
- AxID : []* attrValInt {
662
- {Val : intPtr (754001152 )},
663
- {Val : intPtr (753999904 )},
664
- },
652
+ AxID : f .genAxID (opts ),
665
653
},
666
654
CatAx : f .drawPlotAreaCatAx (opts ),
667
655
ValAx : f .drawPlotAreaValAx (opts ),
@@ -681,10 +669,7 @@ func (f *File) drawScatterChart(opts *Chart) *cPlotArea {
681
669
},
682
670
Ser : f .drawChartSeries (opts ),
683
671
DLbls : f .drawChartDLbls (opts ),
684
- AxID : []* attrValInt {
685
- {Val : intPtr (754001152 )},
686
- {Val : intPtr (753999904 )},
687
- },
672
+ AxID : f .genAxID (opts ),
688
673
},
689
674
CatAx : f .drawPlotAreaCatAx (opts ),
690
675
ValAx : f .drawPlotAreaValAx (opts ),
@@ -698,9 +683,9 @@ func (f *File) drawSurface3DChart(opts *Chart) *cPlotArea {
698
683
Surface3DChart : & cCharts {
699
684
Ser : f .drawChartSeries (opts ),
700
685
AxID : []* attrValInt {
701
- {Val : intPtr (754001152 )},
702
- {Val : intPtr (753999904 )},
703
- {Val : intPtr (832256642 )},
686
+ {Val : intPtr (100000000 )},
687
+ {Val : intPtr (100000001 )},
688
+ {Val : intPtr (100000005 )},
704
689
},
705
690
},
706
691
CatAx : f .drawPlotAreaCatAx (opts ),
@@ -720,9 +705,9 @@ func (f *File) drawSurfaceChart(opts *Chart) *cPlotArea {
720
705
SurfaceChart : & cCharts {
721
706
Ser : f .drawChartSeries (opts ),
722
707
AxID : []* attrValInt {
723
- {Val : intPtr (754001152 )},
724
- {Val : intPtr (753999904 )},
725
- {Val : intPtr (832256642 )},
708
+ {Val : intPtr (100000000 )},
709
+ {Val : intPtr (100000001 )},
710
+ {Val : intPtr (100000005 )},
726
711
},
727
712
},
728
713
CatAx : f .drawPlotAreaCatAx (opts ),
@@ -745,10 +730,7 @@ func (f *File) drawBubbleChart(opts *Chart) *cPlotArea {
745
730
},
746
731
Ser : f .drawChartSeries (opts ),
747
732
DLbls : f .drawChartDLbls (opts ),
748
- AxID : []* attrValInt {
749
- {Val : intPtr (754001152 )},
750
- {Val : intPtr (753999904 )},
751
- },
733
+ AxID : f .genAxID (opts ),
752
734
},
753
735
ValAx : []* cAxs {f .drawPlotAreaCatAx (opts )[0 ], f .drawPlotAreaValAx (opts )[0 ]},
754
736
}
@@ -1050,7 +1032,7 @@ func (f *File) drawPlotAreaCatAx(opts *Chart) []*cAxs {
1050
1032
}
1051
1033
axs := []* cAxs {
1052
1034
{
1053
- AxID : & attrValInt {Val : intPtr (754001152 )},
1035
+ AxID : & attrValInt {Val : intPtr (100000000 )},
1054
1036
Scaling : & cScaling {
1055
1037
Orientation : & attrValString {Val : stringPtr (orientation [opts .XAxis .ReverseOrder ])},
1056
1038
Max : max ,
@@ -1065,7 +1047,7 @@ func (f *File) drawPlotAreaCatAx(opts *Chart) []*cAxs {
1065
1047
TickLblPos : & attrValString {Val : stringPtr ("nextTo" )},
1066
1048
SpPr : f .drawPlotAreaSpPr (),
1067
1049
TxPr : f .drawPlotAreaTxPr (& opts .YAxis ),
1068
- CrossAx : & attrValInt {Val : intPtr (753999904 )},
1050
+ CrossAx : & attrValInt {Val : intPtr (100000001 )},
1069
1051
Crosses : & attrValString {Val : stringPtr ("autoZero" )},
1070
1052
Auto : & attrValBool {Val : boolPtr (true )},
1071
1053
LblAlgn : & attrValString {Val : stringPtr ("ctr" )},
@@ -1085,6 +1067,28 @@ func (f *File) drawPlotAreaCatAx(opts *Chart) []*cAxs {
1085
1067
if opts .XAxis .TickLabelSkip != 0 {
1086
1068
axs [0 ].TickLblSkip = & attrValInt {Val : intPtr (opts .XAxis .TickLabelSkip )}
1087
1069
}
1070
+ if opts .order > 0 && opts .YAxis .Secondary {
1071
+ axs = append (axs , & cAxs {
1072
+ AxID : & attrValInt {Val : intPtr (opts .XAxis .axID )},
1073
+ Scaling : & cScaling {
1074
+ Orientation : & attrValString {Val : stringPtr (orientation [opts .XAxis .ReverseOrder ])},
1075
+ Max : max ,
1076
+ Min : min ,
1077
+ },
1078
+ Delete : & attrValBool {Val : boolPtr (true )},
1079
+ AxPos : & attrValString {Val : stringPtr ("b" )},
1080
+ MajorTickMark : & attrValString {Val : stringPtr ("none" )},
1081
+ MinorTickMark : & attrValString {Val : stringPtr ("none" )},
1082
+ TickLblPos : & attrValString {Val : stringPtr ("nextTo" )},
1083
+ SpPr : f .drawPlotAreaSpPr (),
1084
+ TxPr : f .drawPlotAreaTxPr (& opts .YAxis ),
1085
+ CrossAx : & attrValInt {Val : intPtr (opts .YAxis .axID )},
1086
+ Auto : & attrValBool {Val : boolPtr (true )},
1087
+ LblAlgn : & attrValString {Val : stringPtr ("ctr" )},
1088
+ LblOffset : & attrValInt {Val : intPtr (100 )},
1089
+ NoMultiLvlLbl : & attrValBool {Val : boolPtr (false )},
1090
+ })
1091
+ }
1088
1092
return axs
1089
1093
}
1090
1094
@@ -1104,7 +1108,7 @@ func (f *File) drawPlotAreaValAx(opts *Chart) []*cAxs {
1104
1108
}
1105
1109
axs := []* cAxs {
1106
1110
{
1107
- AxID : & attrValInt {Val : intPtr (753999904 )},
1111
+ AxID : & attrValInt {Val : intPtr (100000001 )},
1108
1112
Scaling : & cScaling {
1109
1113
LogBase : logBase ,
1110
1114
Orientation : & attrValString {Val : stringPtr (orientation [opts .YAxis .ReverseOrder ])},
@@ -1122,7 +1126,7 @@ func (f *File) drawPlotAreaValAx(opts *Chart) []*cAxs {
1122
1126
TickLblPos : & attrValString {Val : stringPtr ("nextTo" )},
1123
1127
SpPr : f .drawPlotAreaSpPr (),
1124
1128
TxPr : f .drawPlotAreaTxPr (& opts .XAxis ),
1125
- CrossAx : & attrValInt {Val : intPtr (754001152 )},
1129
+ CrossAx : & attrValInt {Val : intPtr (100000000 )},
1126
1130
Crosses : & attrValString {Val : stringPtr ("autoZero" )},
1127
1131
CrossBetween : & attrValString {Val : stringPtr (chartValAxCrossBetween [opts .Type ])},
1128
1132
},
@@ -1142,6 +1146,26 @@ func (f *File) drawPlotAreaValAx(opts *Chart) []*cAxs {
1142
1146
if opts .YAxis .MajorUnit != 0 {
1143
1147
axs [0 ].MajorUnit = & attrValFloat {Val : float64Ptr (opts .YAxis .MajorUnit )}
1144
1148
}
1149
+ if opts .order > 0 && opts .YAxis .Secondary {
1150
+ axs = append (axs , & cAxs {
1151
+ AxID : & attrValInt {Val : intPtr (opts .YAxis .axID )},
1152
+ Scaling : & cScaling {
1153
+ Orientation : & attrValString {Val : stringPtr (orientation [opts .YAxis .ReverseOrder ])},
1154
+ Max : max ,
1155
+ Min : min ,
1156
+ },
1157
+ Delete : & attrValBool {Val : boolPtr (false )},
1158
+ AxPos : & attrValString {Val : stringPtr ("r" )},
1159
+ MajorTickMark : & attrValString {Val : stringPtr ("none" )},
1160
+ MinorTickMark : & attrValString {Val : stringPtr ("none" )},
1161
+ TickLblPos : & attrValString {Val : stringPtr ("nextTo" )},
1162
+ SpPr : f .drawPlotAreaSpPr (),
1163
+ TxPr : f .drawPlotAreaTxPr (& opts .XAxis ),
1164
+ CrossAx : & attrValInt {Val : intPtr (opts .XAxis .axID )},
1165
+ Crosses : & attrValString {Val : stringPtr ("max" )},
1166
+ CrossBetween : & attrValString {Val : stringPtr (chartValAxCrossBetween [opts .Type ])},
1167
+ })
1168
+ }
1145
1169
return axs
1146
1170
}
1147
1171
@@ -1157,7 +1181,7 @@ func (f *File) drawPlotAreaSerAx(opts *Chart) []*cAxs {
1157
1181
}
1158
1182
return []* cAxs {
1159
1183
{
1160
- AxID : & attrValInt {Val : intPtr (832256642 )},
1184
+ AxID : & attrValInt {Val : intPtr (100000005 )},
1161
1185
Scaling : & cScaling {
1162
1186
Orientation : & attrValString {Val : stringPtr (orientation [opts .YAxis .ReverseOrder ])},
1163
1187
Max : max ,
@@ -1168,7 +1192,7 @@ func (f *File) drawPlotAreaSerAx(opts *Chart) []*cAxs {
1168
1192
TickLblPos : & attrValString {Val : stringPtr ("nextTo" )},
1169
1193
SpPr : f .drawPlotAreaSpPr (),
1170
1194
TxPr : f .drawPlotAreaTxPr (nil ),
1171
- CrossAx : & attrValInt {Val : intPtr (753999904 )},
1195
+ CrossAx : & attrValInt {Val : intPtr (100000001 )},
1172
1196
},
1173
1197
}
1174
1198
}
@@ -1467,3 +1491,13 @@ func (f *File) deleteDrawing(col, row int, drawingXML, drawingType string) error
1467
1491
f .Drawings .Store (drawingXML , wsDr )
1468
1492
return err
1469
1493
}
1494
+
1495
+ // genAxID provides a function to generate ID for primary and secondary
1496
+ // horizontal or vertical axis.
1497
+ func (f * File ) genAxID (opts * Chart ) []* attrValInt {
1498
+ opts .XAxis .axID , opts .YAxis .axID = 100000000 , 100000001
1499
+ if opts .order > 0 && opts .YAxis .Secondary {
1500
+ opts .XAxis .axID , opts .YAxis .axID = 100000003 , 100000004
1501
+ }
1502
+ return []* attrValInt {{Val : intPtr (opts .XAxis .axID )}, {Val : intPtr (opts .YAxis .axID )}}
1503
+ }
0 commit comments