diff --git a/chart.go b/chart.go
index 5f06c55..2629f0b 100644
--- a/chart.go
+++ b/chart.go
@@ -694,9 +694,9 @@ func parseFormatChartSet(formatSet string) (*formatChart, error) {
//
// Set chart size by dimension property. The dimension property is optional. The default width is 480, and height is 290.
//
-// combo: Specifies the create a chart that combines two art types in a single
-// chart. For example, create a clustered column - line chart with data
-// Sheet1!$E$1:$L$15:
+// 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
//
@@ -782,10 +782,11 @@ func (f *File) DeleteChart(sheet, cell string) (err error) {
}
drawingXML := strings.Replace(f.getSheetRelationshipsTargetByID(sheet, ws.Drawing.RID), "..", "xl", -1)
wsDr, _ = f.drawingParser(drawingXML)
- for idx, anchor := range wsDr.TwoCellAnchor {
- if err = nil; anchor.From != nil && anchor.Pic == nil {
- if anchor.From.Col == col && anchor.From.Row == row {
+ for idx := 0; idx < len(wsDr.TwoCellAnchor); idx++ {
+ if err = nil; wsDr.TwoCellAnchor[idx].From != nil && wsDr.TwoCellAnchor[idx].Pic == nil {
+ if wsDr.TwoCellAnchor[idx].From.Col == col && wsDr.TwoCellAnchor[idx].From.Row == row {
wsDr.TwoCellAnchor = append(wsDr.TwoCellAnchor[:idx], wsDr.TwoCellAnchor[idx+1:]...)
+ idx--
}
}
}
@@ -795,26 +796,18 @@ func (f *File) DeleteChart(sheet, cell string) (err error) {
// deleteChart provides a function to delete chart graphic frame by given by
// given coordinates.
func (f *File) deleteChart(col, row int, drawingXML string, wsDr *xlsxWsDr) (err error) {
- var (
- deWsDr *decodeWsDr
- deTwoCellAnchor *decodeTwoCellAnchor
- )
- deWsDr = new(decodeWsDr)
- if err = f.xmlNewDecoder(bytes.NewReader(namespaceStrictToTransitional(f.readXML(drawingXML)))).
- Decode(deWsDr); err != nil && err != io.EOF {
- err = fmt.Errorf("xml decode error: %s", err)
- return
- }
- for idx, anchor := range deWsDr.TwoCellAnchor {
+ var deTwoCellAnchor *decodeTwoCellAnchor
+ for idx := 0; idx < len(wsDr.TwoCellAnchor); idx++ {
deTwoCellAnchor = new(decodeTwoCellAnchor)
- if err = f.xmlNewDecoder(bytes.NewReader([]byte("" + anchor.Content + ""))).
+ if err = f.xmlNewDecoder(bytes.NewReader([]byte("" + wsDr.TwoCellAnchor[idx].GraphicFrame + ""))).
Decode(deTwoCellAnchor); err != nil && err != io.EOF {
err = fmt.Errorf("xml decode error: %s", err)
return
}
if err = nil; deTwoCellAnchor.From != nil && deTwoCellAnchor.Pic == nil {
- if anchor.From.Col == col && anchor.From.Row == row {
+ if deTwoCellAnchor.From.Col == col && deTwoCellAnchor.From.Row == row {
wsDr.TwoCellAnchor = append(wsDr.TwoCellAnchor[:idx], wsDr.TwoCellAnchor[idx+1:]...)
+ idx--
}
}
}
diff --git a/drawing.go b/drawing.go
index 49506a3..316897b 100644
--- a/drawing.go
+++ b/drawing.go
@@ -563,7 +563,7 @@ func (f *File) drawPie3DChart(formatSet *formatChart) *cPlotArea {
// pie chart by given format sets.
func (f *File) drawPieOfPieChart(formatSet *formatChart) *cPlotArea {
return &cPlotArea{
- PieChart: &cCharts{
+ OfPieChart: &cCharts{
OfPieType: &attrValString{
Val: stringPtr("pie"),
},
@@ -580,7 +580,7 @@ func (f *File) drawPieOfPieChart(formatSet *formatChart) *cPlotArea {
// pie chart by given format sets.
func (f *File) drawBarOfPieChart(formatSet *formatChart) *cPlotArea {
return &cPlotArea{
- PieChart: &cCharts{
+ OfPieChart: &cCharts{
OfPieType: &attrValString{
Val: stringPtr("bar"),
},
diff --git a/xmlChart.go b/xmlChart.go
index 5511469..8d24552 100644
--- a/xmlChart.go
+++ b/xmlChart.go
@@ -331,10 +331,10 @@ type cCharts struct {
RadarStyle *attrValString `xml:"radarStyle"`
ScatterStyle *attrValString `xml:"scatterStyle"`
OfPieType *attrValString `xml:"ofPieType"`
- SerLines *attrValString `xml:"serLines"`
VaryColors *attrValBool `xml:"varyColors"`
Wireframe *attrValBool `xml:"wireframe"`
Ser *[]cSer `xml:"ser"`
+ SerLines *attrValString `xml:"serLines"`
DLbls *cDLbls `xml:"dLbls"`
Shape *attrValString `xml:"shape"`
HoleSize *attrValInt `xml:"holeSize"`