From 9b5b74d4801f60daa580fd282ff9fa058bb03385 Mon Sep 17 00:00:00 2001 From: Ri Xu Date: Mon, 16 Oct 2017 10:42:43 +0800 Subject: Performance optimization, use the array index instead of the value in range. --- chart.go | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'chart.go') 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 -- cgit v1.2.1