From aaeb1816e75586eb49f37ebd2e05ee88a5d8aec5 Mon Sep 17 00:00:00 2001 From: Infacq Date: Wed, 1 Apr 2015 11:31:00 +0800 Subject: [PATCH 1/3] sort by legendIndex --- export-csv.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/export-csv.js b/export-csv.js index 7897b4c..cfcb309 100644 --- a/export-csv.js +++ b/export-csv.js @@ -31,10 +31,14 @@ dateFormat = options.dateFormat || '%Y-%m-%d %H:%M:%S'; // Loop the series and index values - i = 0; + i = 0; + this.series.sort(function (a,b) { + return a.options.legendIndex - b.options.legendIndex + }); each(this.series, function (series) { if (series.options.includeInCSVExport !== false) { names.push(series.name); + //console.log(series.options.legendIndex); each(series.points, function (point) { if (!rows[point.x]) { rows[point.x] = []; @@ -60,7 +64,7 @@ } // Sort it by X values rowArr.sort(function (a, b) { - return a.x - b.x; + return a.x - b.x; }); // Add header row From 05a3b305e79196be41e46d0f93570a44ae2f2d90 Mon Sep 17 00:00:00 2001 From: Infacq Date: Wed, 1 Apr 2015 11:33:33 +0800 Subject: [PATCH 2/3] sort by legendIndex --- export-csv.js | 1 - 1 file changed, 1 deletion(-) diff --git a/export-csv.js b/export-csv.js index cfcb309..3d44a3b 100644 --- a/export-csv.js +++ b/export-csv.js @@ -38,7 +38,6 @@ each(this.series, function (series) { if (series.options.includeInCSVExport !== false) { names.push(series.name); - //console.log(series.options.legendIndex); each(series.points, function (point) { if (!rows[point.x]) { rows[point.x] = []; From cf6f8d234e2d2f2c29713465c48d30a0a05118a2 Mon Sep 17 00:00:00 2001 From: Infacq Date: Thu, 2 Apr 2015 10:01:29 +0800 Subject: [PATCH 3/3] refer to aaeb181 --- export-csv.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/export-csv.js b/export-csv.js index 3d44a3b..c103c8b 100644 --- a/export-csv.js +++ b/export-csv.js @@ -24,6 +24,7 @@ rowArr = [], dataRows, names = [], + serieses = this.series.slice(), i, x, @@ -32,10 +33,10 @@ // Loop the series and index values i = 0; - this.series.sort(function (a,b) { + serieses.sort(function (a,b) { return a.options.legendIndex - b.options.legendIndex }); - each(this.series, function (series) { + each(serieses, function (series) { if (series.options.includeInCSVExport !== false) { names.push(series.name); each(series.points, function (point) {