summaryrefslogtreecommitdiff
path: root/chart.go
diff options
context:
space:
mode:
authorRi Xu <xuri.me@gmail.com>2017-10-16 10:42:43 +0800
committerRi Xu <xuri.me@gmail.com>2017-10-16 10:42:43 +0800
commit9b5b74d4801f60daa580fd282ff9fa058bb03385 (patch)
tree932febf22a36d6b03095070c98ac94c690ab59ef /chart.go
parent905be463edc6d9b0ed184bdee0116217a5118c5e (diff)
Performance optimization, use the array index instead of the value in range.
Diffstat (limited to 'chart.go')
-rw-r--r--chart.go12
1 files changed, 6 insertions, 6 deletions
diff --git a/chart.go b/chart.go
index f36c83a..e6cb94f 100644
--- a/chart.go
+++ b/chart.go
@@ -550,23 +550,23 @@ func (f *File) drawScatterChart(formatSet *formatChart) *cPlotArea {
// sets.
func (f *File) drawChartSeries(formatSet *formatChart) *[]cSer {
ser := []cSer{}
- for k, v := range formatSet.Series {
+ for k := range formatSet.Series {
ser = append(ser, cSer{
IDx: &attrValInt{Val: k},
Order: &attrValInt{Val: k},
Tx: &cTx{
StrRef: &cStrRef{
- F: v.Name,
+ F: formatSet.Series[k].Name,
},
},
SpPr: f.drawChartSeriesSpPr(k, formatSet),
Marker: f.drawChartSeriesMarker(k, formatSet),
DPt: f.drawChartSeriesDPt(k, formatSet),
DLbls: f.drawChartSeriesDLbls(formatSet),
- Cat: f.drawChartSeriesCat(v, formatSet),
- Val: f.drawChartSeriesVal(v, formatSet),
- XVal: f.drawChartSeriesXVal(v, formatSet),
- YVal: f.drawChartSeriesYVal(v, formatSet),
+ Cat: f.drawChartSeriesCat(formatSet.Series[k], formatSet),
+ Val: f.drawChartSeriesVal(formatSet.Series[k], formatSet),
+ XVal: f.drawChartSeriesXVal(formatSet.Series[k], formatSet),
+ YVal: f.drawChartSeriesYVal(formatSet.Series[k], formatSet),
})
}
return &ser