From: Dan Vanderkam Date: Sat, 12 Dec 2009 00:17:29 +0000 (-0800) Subject: add support for errorBars to gviz gadget X-Git-Tag: v1.0.0~805 X-Git-Url: https://adrianiainlam.tk/git/?a=commitdiff_plain;h=3e3f84e4cc861dd0582531c220937f78d5b2bfc3;p=dygraphs.git add support for errorBars to gviz gadget --- 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 @@ +