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') {
} 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);
}
<UserPref name="_dg_minY" display_name="Min Y Value" required="false" default_value="" />
<UserPref name="_dg_maxY" display_name="Max Y Value" required="false" default_value="" />
<UserPref name="_dg_kmb" display_name="KMB labels" required="false" default_value="false" datatype="bool" />
+ <UserPref name="_dg_errorbars" display_name="Error Bars" required="false" default_value="false" datatype="bool" />
<!--
This is a sample gadget, that uses the Google Visualization API to read data
from a data source, and displays it as an html table.
var showRoller = prefs.getBool("_dg_showRoller");
var rollPeriod = prefs.getInt("_dg_rollPeriod");
var labelsKMB = prefs.getBool("_dg_kmb");
+ var errorBars = prefs.getBool("_dg_errorbars");
var opts = {
showRoller: showRoller,
rollPeriod: rollPeriod,
- labelsKMB: labelsKMB
+ labelsKMB: labelsKMB,
+ errorBars: errorBars
};
var minY = prefs.getString("_dg_minY");
document.getElementById('gviz')).draw(data, null);
new Dygraph.GVizChart(
- document.getElementById('dygraphs')).draw(data, null);
+ document.getElementById('dygraphs')).draw(data, {
+ errorBars: true
+ });
}
google.setOnLoadCallback(drawVisualization);
</script>