From 3e3f84e4cc861dd0582531c220937f78d5b2bfc3 Mon Sep 17 00:00:00 2001 From: Dan Vanderkam Date: Fri, 11 Dec 2009 16:17:29 -0800 Subject: [PATCH] add support for errorBars to gviz gadget --- dygraph.js | 12 ++++++++++-- gadget.xml | 5 ++++- tests/gviz.html | 4 +++- 3 files changed, 17 insertions(+), 4 deletions(-) diff --git a/dygraph.js b/dygraph.js index bdfa1b1..4fc26bc 100644 --- a/dygraph.js +++ b/dygraph.js @@ -1560,8 +1560,10 @@ Dygraph.prototype.parseDataTable_ = function(data) { var labels = []; for (var i = 0; i < cols; i++) { labels.push(data.getColumnLabel(i)); + if (i != 0 && this.attr_("errorBars")) i += 1; } this.attrs_.labels = labels; + cols = labels.length; var indepType = data.getColumnType(0); if (indepType == 'date') { @@ -1587,8 +1589,14 @@ Dygraph.prototype.parseDataTable_ = function(data) { } else { row.push(data.getValue(i, 0)); } - for (var j = 1; j < cols; j++) { - row.push(data.getValue(i, j)); + if (!this.attr_("errorBars")) { + for (var j = 1; j < cols; j++) { + row.push(data.getValue(i, j)); + } + } else { + for (var j = 0; j < cols - 1; j++) { + row.push([ data.getValue(i, 1 + 2 * j), data.getValue(i, 2 + 2 * j) ]); + } } ret.push(row); } diff --git a/gadget.xml b/gadget.xml index 885d0ea..18206aa 100644 --- a/gadget.xml +++ b/gadget.xml @@ -28,6 +28,7 @@ +