func (f *File) drawRadarChart(formatSet *formatChart) *cPlotArea {
	return &cPlotArea{
		RadarChart: &cCharts{
			RadarStyle: &attrValString{
				Val: "marker",
			},
			VaryColors: &attrValBool{
				Val: false,
			},
			Ser:   f.drawChartSeries(formatSet),
			DLbls: f.drawChartDLbls(formatSet),
			AxID: []*attrValInt{
				{Val: 754001152},
				{Val: 753999904},
			},
		},
		CatAx: f.drawPlotAreaCatAx(formatSet),
		ValAx: f.drawPlotAreaValAx(formatSet),
	}
}
drawRadarChart provides function to draw the c:plotArea element for radar
chart by given format sets.
package excelize
import (
	"encoding/json"
	"encoding/xml"
	"strconv"
	"strings"
)
const (
	Bar                 = "bar"
	BarStacked          = "barStacked"
	BarPercentStacked   = "barPercentStacked"
	Bar3DClustered      = "bar3DClustered"
	Bar3DStacked        = "bar3DStacked"
	Bar3DPercentStacked = "bar3DPercentStacked"
	Col                 = "col"
	ColStacked          = "colStacked"
	ColPercentStacked   = "colPercentStacked"
	Col3DClustered      = "col3DClustered"
	Col3D               = "col3D"
	Col3DStacked        = "col3DStacked"
	Col3DPercentStacked = "col3DPercentStacked"
	Doughnut            = "doughnut"
	Line                = "line"
	Pie                 = "pie"
	Pie3D               = "pie3D"
	Radar               = "radar"
	Scatter             = "scatter"
)
var (
	chartView3DRotX = map[string]int{
		Bar:                 0,
		BarStacked:          0,
		BarPercentStacked:   0,
		Bar3DClustered:      15,
		Bar3DStacked:        15,
		Bar3DPercentStacked: 15,
		Col:                 0,
		ColStacked:          0,
		ColPercentStacked:   0,
		Col3DClustered:      15,
		Col3D:               15,
		Col3DStacked:        15,
		Col3DPercentStacked: 15,
		Doughnut:            0,
		Line:                0,
		Pie:                 0,
		Pie3D:               30,
		Radar:               0,
		Scatter:             0,
	}
	chartView3DRotY = map[string]int{
		Bar:                 0,
		BarStacked:          0,
		BarPercentStacked:   0,
		Bar3DClustered:      20,
		Bar3DStacked:        20,
		Bar3DPercentStacked: 20,
		Col:                 0,
		ColStacked:          0,
		ColPercentStacked:   0,
		Col3DClustered:      20,
		Col3D:               20,
		Col3DStacked:        20,
		Col3DPercentStacked: 20,
		Doughnut:            0,
		Line:                0,
		Pie:                 0,
		Pie3D:               0,
		Radar:               0,
		Scatter:             0,
	}
	chartView3DDepthPercent = map[string]int{
		Bar:                 100,
		BarStacked:          100,
		BarPercentStacked:   100,
		Bar3DClustered:      100,
		Bar3DStacked:        100,
		Bar3DPercentStacked: 100,
		Col:                 100,
		ColStacked:          100,
		ColPercentStacked:   100,
		Col3DClustered:      100,
		Col3D:               100,
		Col3DStacked:        100,
		Col3DPercentStacked: 100,
		Doughnut:            100,
		Line:                100,
		Pie:                 100,
		Pie3D:               100,
		Radar:               100,
		Scatter:             100,
	}
	chartView3DRAngAx = map[string]int{
		Bar:                 0,
		BarStacked:          0,
		BarPercentStacked:   0,
		Bar3DClustered:      1,
		Bar3DStacked:        1,
		Bar3DPercentStacked: 1,
		Col:                 0,
		ColStacked:          0,
		ColPercentStacked:   0,
		Col3DClustered:      1,
		Col3D:               1,
		Col3DStacked:        1,
		Col3DPercentStacked: 1,
		Doughnut:            0,
		Line:                0,
		Pie:                 0,
		Pie3D:               0,
		Radar:               0,
		Scatter:             0,
	}
	chartLegendPosition = map[string]string{
		"bottom":    "b",
		"left":      "l",
		"right":     "r",
		"top":       "t",
		"top_right": "tr",
	}
	chartValAxNumFmtFormatCode = map[string]string{
		Bar:                 "General",
		BarStacked:          "General",
		BarPercentStacked:   "0%",
		Bar3DClustered:      "General",
		Bar3DStacked:        "General",
		Bar3DPercentStacked: "0%",
		Col:                 "General",
		ColStacked:          "General",
		ColPercentStacked:   "0%",
		Col3DClustered:      "General",
		Col3D:               "General",
		Col3DStacked:        "General",
		Col3DPercentStacked: "0%",
		Doughnut:            "General",
		Line:                "General",
		Pie:                 "General",
		Pie3D:               "General",
		Radar:               "General",
		Scatter:             "General",
	}
	plotAreaChartGrouping = map[string]string{
		Bar:                 "clustered",
		BarStacked:          "stacked",
		BarPercentStacked:   "percentStacked",
		Bar3DClustered:      "clustered",
		Bar3DStacked:        "stacked",
		Bar3DPercentStacked: "percentStacked",
		Col:                 "clustered",
		ColStacked:          "stacked",
		ColPercentStacked:   "percentStacked",
		Col3DClustered:      "clustered",
		Col3D:               "standard",
		Col3DStacked:        "stacked",
		Col3DPercentStacked: "percentStacked",
		Line:                "standard",
	}
	plotAreaChartBarDir = map[string]string{
		Bar:                 "bar",
		BarStacked:          "bar",
		BarPercentStacked:   "bar",
		Bar3DClustered:      "bar",
		Bar3DStacked:        "bar",
		Bar3DPercentStacked: "bar",
		Col:                 "col",
		ColStacked:          "col",
		ColPercentStacked:   "col",
		Col3DClustered:      "col",
		Col3D:               "col",
		Col3DStacked:        "col",
		Col3DPercentStacked: "col",
		Line:                "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",
	}
)
func parseFormatChartSet(formatSet string) *formatChart {
	format := formatChart{
		Dimension: formatChartDimension{
			Width:  480,
			Height: 290,
		},
		Format: formatPicture{
			FPrintsWithSheet: true,
			FLocksWithSheet:  false,
			NoChangeAspect:   false,
			OffsetX:          0,
			OffsetY:          0,
			XScale:           1.0,
			YScale:           1.0,
		},
		Legend: formatChartLegend{
			Position:      "bottom",
			ShowLegendKey: false,
		},
		Title: formatChartTitle{
			Name: " ",
		},
		ShowBlanksAs: "gap",
	}
	json.Unmarshal([]byte(formatSet), &format)
	return &format
}
func (f *File) AddChart(sheet, cell, format string) {
	formatSet := parseFormatChartSet(format)
	xlsx := f.workSheetReader(sheet)
	drawingID := f.countDrawings() + 1
	chartID := f.countCharts() + 1
	drawingXML := "xl/drawings/drawing" + strconv.Itoa(drawingID) + ".xml"
	drawingID, drawingXML = f.prepareDrawing(xlsx, drawingID, sheet, drawingXML)
	drawingRID := f.addDrawingRelationships(drawingID, SourceRelationshipChart, "../charts/chart"+strconv.Itoa(chartID)+".xml", "")
	f.addDrawingChart(sheet, drawingXML, cell, formatSet.Dimension.Width, formatSet.Dimension.Height, drawingRID, &formatSet.Format)
	f.addChart(formatSet)
	f.addContentTypePart(chartID, "chart")
	f.addContentTypePart(drawingID, "drawings")
}
func (f *File) countCharts() int {
	count := 0
	for k := range f.XLSX {
		if strings.Contains(k, "xl/charts/chart") {
			count++
		}
	}
	return count
}
func (f *File) prepareDrawing(xlsx *xlsxWorksheet, drawingID int, sheet, drawingXML string) (int, string) {
	sheetRelationshipsDrawingXML := "../drawings/drawing" + strconv.Itoa(drawingID) + ".xml"
	if xlsx.Drawing != nil {
		sheetRelationshipsDrawingXML = f.getSheetRelationshipsTargetByID(sheet, xlsx.Drawing.RID)
		drawingID, _ = strconv.Atoi(strings.TrimSuffix(strings.TrimPrefix(sheetRelationshipsDrawingXML, "../drawings/drawing"), ".xml"))
		drawingXML = strings.Replace(sheetRelationshipsDrawingXML, "..", "xl", -1)
	} else {
		rID := f.addSheetRelationships(sheet, SourceRelationshipDrawingML, sheetRelationshipsDrawingXML, "")
		f.addSheetDrawing(sheet, rID)
	}
	return drawingID, drawingXML
}
func (f *File) addChart(formatSet *formatChart) {
	count := f.countCharts()
	xlsxChartSpace := xlsxChartSpace{
		XMLNSc:         NameSpaceDrawingMLChart,
		XMLNSa:         NameSpaceDrawingML,
		XMLNSr:         SourceRelationship,
		XMLNSc16r2:     SourceRelationshipChart201506,
		Date1904:       &attrValBool{Val: false},
		Lang:           &attrValString{Val: "en-US"},
		RoundedCorners: &attrValBool{Val: false},
		Chart: cChart{
			Title: &cTitle{
				Tx: cTx{
					Rich: &cRich{
						P: aP{
							PPr: &aPPr{
								DefRPr: aRPr{
									Kern:   1200,
									Strike: "noStrike",
									U:      "none",
									Sz:     1400,
									SolidFill: &aSolidFill{
										SchemeClr: &aSchemeClr{
											Val: "tx1",
											LumMod: &attrValInt{
												Val: 65000,
											},
											LumOff: &attrValInt{
												Val: 35000,
											},
										},
									},
									Ea: &aEa{
										Typeface: "+mn-ea",
									},
									Cs: &aCs{
										Typeface: "+mn-cs",
									},
									Latin: &aLatin{
										Typeface: "+mn-lt",
									},
								},
							},
							R: &aR{
								RPr: aRPr{
									Lang:    "en-US",
									AltLang: "en-US",
								},
								T: formatSet.Title.Name,
							},
						},
					},
				},
				TxPr: cTxPr{
					P: aP{
						PPr: &aPPr{
							DefRPr: aRPr{
								Kern:   1200,
								U:      "none",
								Sz:     14000,
								Strike: "noStrike",
							},
						},
						EndParaRPr: &aEndParaRPr{
							Lang: "en-US",
						},
					},
				},
			},
			View3D: &cView3D{
				RotX:         &attrValInt{Val: chartView3DRotX[formatSet.Type]},
				RotY:         &attrValInt{Val: chartView3DRotY[formatSet.Type]},
				DepthPercent: &attrValInt{Val: chartView3DDepthPercent[formatSet.Type]},
				RAngAx:       &attrValInt{Val: chartView3DRAngAx[formatSet.Type]},
			},
			Floor: &cThicknessSpPr{
				Thickness: &attrValInt{Val: 0},
			},
			SideWall: &cThicknessSpPr{
				Thickness: &attrValInt{Val: 0},
			},
			BackWall: &cThicknessSpPr{
				Thickness: &attrValInt{Val: 0},
			},
			PlotArea: &cPlotArea{},
			Legend: &cLegend{
				LegendPos: &attrValString{Val: chartLegendPosition[formatSet.Legend.Position]},
				Overlay:   &attrValBool{Val: false},
			},
			PlotVisOnly:      &attrValBool{Val: false},
			DispBlanksAs:     &attrValString{Val: formatSet.ShowBlanksAs},
			ShowDLblsOverMax: &attrValBool{Val: false},
		},
		SpPr: &cSpPr{
			SolidFill: &aSolidFill{
				SchemeClr: &aSchemeClr{Val: "bg1"},
			},
			Ln: &aLn{
				W:    9525,
				Cap:  "flat",
				Cmpd: "sng",
				Algn: "ctr",
				SolidFill: &aSolidFill{
					SchemeClr: &aSchemeClr{Val: "tx1",
						LumMod: &attrValInt{
							Val: 15000,
						},
						LumOff: &attrValInt{
							Val: 85000,
						},
					},
				},
			},
		},
		PrintSettings: &cPrintSettings{
			PageMargins: &cPageMargins{
				B:      0.75,
				L:      0.7,
				R:      0.7,
				T:      0.7,
				Header: 0.3,
				Footer: 0.3,
			},
		},
	}
	plotAreaFunc := map[string]func(*formatChart) *cPlotArea{
		Bar:                 f.drawBaseChart,
		BarStacked:          f.drawBaseChart,
		BarPercentStacked:   f.drawBaseChart,
		Bar3DClustered:      f.drawBaseChart,
		Bar3DStacked:        f.drawBaseChart,
		Bar3DPercentStacked: f.drawBaseChart,
		Col:                 f.drawBaseChart,
		ColStacked:          f.drawBaseChart,
		ColPercentStacked:   f.drawBaseChart,
		Col3DClustered:      f.drawBaseChart,
		Col3D:               f.drawBaseChart,
		Col3DStacked:        f.drawBaseChart,
		Col3DPercentStacked: f.drawBaseChart,
		Doughnut:            f.drawDoughnutChart,
		Line:                f.drawLineChart,
		Pie3D:               f.drawPie3DChart,
		Pie:                 f.drawPieChart,
		Radar:               f.drawRadarChart,
		Scatter:             f.drawScatterChart,
	}
	xlsxChartSpace.Chart.PlotArea = plotAreaFunc[formatSet.Type](formatSet)
	chart, _ := xml.Marshal(xlsxChartSpace)
	media := "xl/charts/chart" + strconv.Itoa(count+1) + ".xml"
	f.saveFileList(media, chart)
}
func (f *File) drawBaseChart(formatSet *formatChart) *cPlotArea {
	c := cCharts{
		BarDir: &attrValString{
			Val: "col",
		},
		Grouping: &attrValString{
			Val: "clustered",
		},
		VaryColors: &attrValBool{
			Val: true,
		},
		Ser:   f.drawChartSeries(formatSet),
		DLbls: f.drawChartDLbls(formatSet),
		AxID: []*attrValInt{
			{Val: 754001152},
			{Val: 753999904},
		},
	}
	c.BarDir.Val = plotAreaChartBarDir[formatSet.Type]
	c.Grouping.Val = plotAreaChartGrouping[formatSet.Type]
	if formatSet.Type == "colStacked" || formatSet.Type == "barStacked" || formatSet.Type == "barPercentStacked" || formatSet.Type == "colPercentStacked" {
		c.Overlap = &attrValInt{Val: 100}
	}
	catAx := f.drawPlotAreaCatAx(formatSet)
	valAx := f.drawPlotAreaValAx(formatSet)
	charts := map[string]*cPlotArea{
		"bar": {
			BarChart: &c,
			CatAx:    catAx,
			ValAx:    valAx,
		},
		"barStacked": {
			BarChart: &c,
			CatAx:    catAx,
			ValAx:    valAx,
		},
		"barPercentStacked": {
			BarChart: &c,
			CatAx:    catAx,
			ValAx:    valAx,
		},
		"bar3DClustered": {
			Bar3DChart: &c,
			CatAx:      catAx,
			ValAx:      valAx,
		},
		"bar3DStacked": {
			Bar3DChart: &c,
			CatAx:      catAx,
			ValAx:      valAx,
		},
		"bar3DPercentStacked": {
			Bar3DChart: &c,
			CatAx:      catAx,
			ValAx:      valAx,
		},
		"col": {
			BarChart: &c,
			CatAx:    catAx,
			ValAx:    valAx,
		},
		"colStacked": {
			BarChart: &c,
			CatAx:    catAx,
			ValAx:    valAx,
		},
		"colPercentStacked": {
			BarChart: &c,
			CatAx:    catAx,
			ValAx:    valAx,
		},
		"col3DClustered": {
			Bar3DChart: &c,
			CatAx:      catAx,
			ValAx:      valAx,
		},
		"col3D": {
			Bar3DChart: &c,
			CatAx:      catAx,
			ValAx:      valAx,
		},
		"col3DStacked": {
			Bar3DChart: &c,
			CatAx:      catAx,
			ValAx:      valAx,
		},
		"col3DPercentStacked": {
			Bar3DChart: &c,
			CatAx:      catAx,
			ValAx:      valAx,
		},
	}
	return charts[formatSet.Type]
}
func (f *File) drawDoughnutChart(formatSet *formatChart) *cPlotArea {
	return &cPlotArea{
		DoughnutChart: &cCharts{
			VaryColors: &attrValBool{
				Val: true,
			},
			Ser:      f.drawChartSeries(formatSet),
			HoleSize: &attrValInt{Val: 75},
		},
	}
}
func (f *File) drawLineChart(formatSet *formatChart) *cPlotArea {
	return &cPlotArea{
		LineChart: &cCharts{
			Grouping: &attrValString{
				Val: plotAreaChartGrouping[formatSet.Type],
			},
			VaryColors: &attrValBool{
				Val: false,
			},
			Ser:   f.drawChartSeries(formatSet),
			DLbls: f.drawChartDLbls(formatSet),
			Smooth: &attrValBool{
				Val: false,
			},
			AxID: []*attrValInt{
				{Val: 754001152},
				{Val: 753999904},
			},
		},
		CatAx: f.drawPlotAreaCatAx(formatSet),
		ValAx: f.drawPlotAreaValAx(formatSet),
	}
}
func (f *File) drawPieChart(formatSet *formatChart) *cPlotArea {
	return &cPlotArea{
		PieChart: &cCharts{
			VaryColors: &attrValBool{
				Val: true,
			},
			Ser: f.drawChartSeries(formatSet),
		},
	}
}
func (f *File) drawPie3DChart(formatSet *formatChart) *cPlotArea {
	return &cPlotArea{
		Pie3DChart: &cCharts{
			VaryColors: &attrValBool{
				Val: true,
			},
			Ser: f.drawChartSeries(formatSet),
		},
	}
}