@@ -65,6 +65,10 @@ const (
6565 Pie3D = "pie3D"
6666 Radar = "radar"
6767 Scatter = "scatter"
68+ Surface3D = "surface3D"
69+ WireframeSurface3D = "wireframeSurface3D"
70+ Contour = "contour"
71+ WireframeContour = "wireframeContour"
6872)
6973
7074// This section defines the default value of chart properties.
@@ -116,6 +120,10 @@ var (
116120 Pie3D : 30 ,
117121 Radar : 0 ,
118122 Scatter : 0 ,
123+ Surface3D : 15 ,
124+ WireframeSurface3D : 15 ,
125+ Contour : 90 ,
126+ WireframeContour : 90 ,
119127 }
120128 chartView3DRotY = map [string ]int {
121129 Area : 0 ,
@@ -164,6 +172,10 @@ var (
164172 Pie3D : 0 ,
165173 Radar : 0 ,
166174 Scatter : 0 ,
175+ Surface3D : 20 ,
176+ WireframeSurface3D : 20 ,
177+ Contour : 0 ,
178+ WireframeContour : 0 ,
167179 }
168180 chartView3DDepthPercent = map [string ]int {
169181 Area : 100 ,
@@ -212,6 +224,14 @@ var (
212224 Pie3D : 100 ,
213225 Radar : 100 ,
214226 Scatter : 100 ,
227+ Surface3D : 100 ,
228+ WireframeSurface3D : 100 ,
229+ Contour : 100 ,
230+ WireframeContour : 100 ,
231+ }
232+ chartView3DPerspective = map [string ]int {
233+ Contour : 0 ,
234+ WireframeContour : 0 ,
215235 }
216236 chartView3DRAngAx = map [string ]int {
217237 Area : 0 ,
@@ -260,6 +280,9 @@ var (
260280 Pie3D : 0 ,
261281 Radar : 0 ,
262282 Scatter : 0 ,
283+ Surface3D : 0 ,
284+ WireframeSurface3D : 0 ,
285+ Contour : 0 ,
263286 }
264287 chartLegendPosition = map [string ]string {
265288 "bottom" : "b" ,
@@ -315,6 +338,10 @@ var (
315338 Pie3D : "General" ,
316339 Radar : "General" ,
317340 Scatter : "General" ,
341+ Surface3D : "General" ,
342+ WireframeSurface3D : "General" ,
343+ Contour : "General" ,
344+ WireframeContour : "General" ,
318345 }
319346 chartValAxCrossBetween = map [string ]string {
320347 Area : "midCat" ,
@@ -363,6 +390,10 @@ var (
363390 Pie3D : "between" ,
364391 Radar : "between" ,
365392 Scatter : "between" ,
393+ Surface3D : "midCat" ,
394+ WireframeSurface3D : "midCat" ,
395+ Contour : "midCat" ,
396+ WireframeContour : "midCat" ,
366397 }
367398 plotAreaChartGrouping = map [string ]string {
368399 Area : "standard" ,
@@ -456,6 +487,10 @@ var (
456487 true : "r" ,
457488 false : "l" ,
458489 }
490+ valTickLblPos = map [string ]string {
491+ Contour : "none" ,
492+ WireframeContour : "none" ,
493+ }
459494)
460495
461496// parseFormatChartSet provides a function to parse the format settings of the
@@ -573,6 +608,10 @@ func parseFormatChartSet(formatSet string) (*formatChart, error) {
573608// pie3D | 3D pie chart
574609// radar | radar chart
575610// scatter | scatter chart
611+ // surface3D | 3D surface chart
612+ // wireframeSurface3D | 3D wireframe surface chart
613+ // contour | contour chart
614+ // wireframeContour | wireframe contour
576615//
577616// In Excel a chart series is a collection of information that defines which data is plotted such as values, axis labels and formatting.
578617//
@@ -791,6 +830,7 @@ func (f *File) addChart(formatSet *formatChart) {
791830 RotX : & attrValInt {Val : chartView3DRotX [formatSet .Type ]},
792831 RotY : & attrValInt {Val : chartView3DRotY [formatSet .Type ]},
793832 DepthPercent : & attrValInt {Val : chartView3DDepthPercent [formatSet .Type ]},
833+ Perspective : & attrValInt {Val : chartView3DPerspective [formatSet .Type ]},
794834 RAngAx : & attrValInt {Val : chartView3DRAngAx [formatSet .Type ]},
795835 },
796836 Floor : & cThicknessSpPr {
@@ -891,6 +931,10 @@ func (f *File) addChart(formatSet *formatChart) {
891931 Pie : f .drawPieChart ,
892932 Radar : f .drawRadarChart ,
893933 Scatter : f .drawScatterChart ,
934+ Surface3D : f .drawSurface3DChart ,
935+ WireframeSurface3D : f .drawSurface3DChart ,
936+ Contour : f .drawSurfaceChart ,
937+ WireframeContour : f .drawSurfaceChart ,
894938 }
895939 xlsxChartSpace .Chart .PlotArea = plotAreaFunc [formatSet.Type ](formatSet )
896940
@@ -1248,6 +1292,52 @@ func (f *File) drawScatterChart(formatSet *formatChart) *cPlotArea {
12481292 }
12491293}
12501294
1295+ // drawSurface3DChart provides a function to draw the c:surface3DChart element by
1296+ // given format sets.
1297+ func (f * File ) drawSurface3DChart (formatSet * formatChart ) * cPlotArea {
1298+ plotArea := & cPlotArea {
1299+ Surface3DChart : & cCharts {
1300+ Ser : f .drawChartSeries (formatSet ),
1301+ AxID : []* attrValInt {
1302+ {Val : 754001152 },
1303+ {Val : 753999904 },
1304+ {Val : 832256642 },
1305+ },
1306+ },
1307+ CatAx : f .drawPlotAreaCatAx (formatSet ),
1308+ ValAx : f .drawPlotAreaValAx (formatSet ),
1309+ SerAx : f .drawPlotAreaSerAx (formatSet ),
1310+ }
1311+ if formatSet .Type == WireframeSurface3D {
1312+ plotArea .Surface3DChart .Wireframe = & attrValBool {Val : true }
1313+ }
1314+ return plotArea
1315+ }
1316+
1317+ // drawSurfaceChart provides a function to draw the c:surfaceChart element by
1318+ // given format sets.
1319+ func (f * File ) drawSurfaceChart (formatSet * formatChart ) * cPlotArea {
1320+ plotArea := & cPlotArea {
1321+ SurfaceChart : & cCharts {
1322+ Ser : f .drawChartSeries (formatSet ),
1323+ AxID : []* attrValInt {
1324+ {Val : 754001152 },
1325+ {Val : 753999904 },
1326+ {Val : 832256642 },
1327+ },
1328+ },
1329+ CatAx : f .drawPlotAreaCatAx (formatSet ),
1330+ ValAx : f .drawPlotAreaValAx (formatSet ),
1331+ SerAx : f .drawPlotAreaSerAx (formatSet ),
1332+ }
1333+ if formatSet .Type == WireframeContour {
1334+ plotArea .SurfaceChart .Wireframe = & attrValBool {Val : true }
1335+ }
1336+ return plotArea
1337+ }
1338+
1339+ // drawChartShape provides a function to draw the c:shape element by given
1340+ // format sets.
12511341func (f * File ) drawChartShape (formatSet * formatChart ) * attrValString {
12521342 shapes := map [string ]string {
12531343 Bar3DConeClustered : "cone" ,
@@ -1273,9 +1363,7 @@ func (f *File) drawChartShape(formatSet *formatChart) *attrValString {
12731363 Col3DCylinderPercentStacked : "cylinder" ,
12741364 }
12751365 if shape , ok := shapes [formatSet .Type ]; ok {
1276- return & attrValString {
1277- Val : shape ,
1278- }
1366+ return & attrValString {Val : shape }
12791367 }
12801368 return nil
12811369}
@@ -1459,7 +1547,7 @@ func (f *File) drawChartDLbls(formatSet *formatChart) *cDLbls {
14591547// given format sets.
14601548func (f * File ) drawChartSeriesDLbls (formatSet * formatChart ) * cDLbls {
14611549 dLbls := f .drawChartDLbls (formatSet )
1462- chartSeriesDLbls := map [string ]* cDLbls {Scatter : nil }
1550+ chartSeriesDLbls := map [string ]* cDLbls {Scatter : nil , Surface3D : nil , WireframeSurface3D : nil , Contour : nil , WireframeContour : nil }
14631551 if _ , ok := chartSeriesDLbls [formatSet .Type ]; ok {
14641552 return nil
14651553 }
@@ -1476,7 +1564,7 @@ func (f *File) drawPlotAreaCatAx(formatSet *formatChart) []*cAxs {
14761564 if formatSet .XAxis .Maximum == 0 {
14771565 max = nil
14781566 }
1479- return []* cAxs {
1567+ axs := []* cAxs {
14801568 {
14811569 AxID : & attrValInt {Val : 754001152 },
14821570 Scaling : & cScaling {
@@ -1503,6 +1591,10 @@ func (f *File) drawPlotAreaCatAx(formatSet *formatChart) []*cAxs {
15031591 NoMultiLvlLbl : & attrValBool {Val : false },
15041592 },
15051593 }
1594+ if formatSet .XAxis .MajorGridlines {
1595+ axs [0 ].MajorGridlines = & cChartLines {SpPr : f .drawPlotAreaSpPr ()}
1596+ }
1597+ return axs
15061598}
15071599
15081600// drawPlotAreaValAx provides a function to draw the c:valAx element.
@@ -1515,7 +1607,7 @@ func (f *File) drawPlotAreaValAx(formatSet *formatChart) []*cAxs {
15151607 if formatSet .YAxis .Maximum == 0 {
15161608 max = nil
15171609 }
1518- return []* cAxs {
1610+ axs := []* cAxs {
15191611 {
15201612 AxID : & attrValInt {Val : 753999904 },
15211613 Scaling : & cScaling {
@@ -1539,6 +1631,41 @@ func (f *File) drawPlotAreaValAx(formatSet *formatChart) []*cAxs {
15391631 CrossBetween : & attrValString {Val : chartValAxCrossBetween [formatSet .Type ]},
15401632 },
15411633 }
1634+ if formatSet .YAxis .MajorGridlines {
1635+ axs [0 ].MajorGridlines = & cChartLines {SpPr : f .drawPlotAreaSpPr ()}
1636+ }
1637+ if pos , ok := valTickLblPos [formatSet .Type ]; ok {
1638+ axs [0 ].TickLblPos .Val = pos
1639+ }
1640+ return axs
1641+ }
1642+
1643+ // drawPlotAreaSerAx provides a function to draw the c:serAx element.
1644+ func (f * File ) drawPlotAreaSerAx (formatSet * formatChart ) []* cAxs {
1645+ min := & attrValFloat {Val : formatSet .YAxis .Minimum }
1646+ max := & attrValFloat {Val : formatSet .YAxis .Maximum }
1647+ if formatSet .YAxis .Minimum == 0 {
1648+ min = nil
1649+ }
1650+ if formatSet .YAxis .Maximum == 0 {
1651+ max = nil
1652+ }
1653+ return []* cAxs {
1654+ {
1655+ AxID : & attrValInt {Val : 832256642 },
1656+ Scaling : & cScaling {
1657+ Orientation : & attrValString {Val : orientation [formatSet .YAxis .ReverseOrder ]},
1658+ Max : max ,
1659+ Min : min ,
1660+ },
1661+ Delete : & attrValBool {Val : false },
1662+ AxPos : & attrValString {Val : catAxPos [formatSet .XAxis .ReverseOrder ]},
1663+ TickLblPos : & attrValString {Val : "nextTo" },
1664+ SpPr : f .drawPlotAreaSpPr (),
1665+ TxPr : f .drawPlotAreaTxPr (),
1666+ CrossAx : & attrValInt {Val : 753999904 },
1667+ },
1668+ }
15421669}
15431670
15441671// drawPlotAreaSpPr provides a function to draw the c:spPr element.
0 commit comments