summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndy Doan <doanac@gmail.com>2012-01-23 12:08:25 -0600
committerAndy Doan <doanac@gmail.com>2012-01-23 12:08:25 -0600
commitea710788a4d8e597331cbe3be42f7598eaf3be57 (patch)
tree9e59e3f2f35d31f29efebcdcb862a489d87804f4
parent5159fc263510f6fbcf0219ed29a9dc37c7d26ca2 (diff)
downloadandroid_benchmark_views-ea710788a4d8e597331cbe3be42f7598eaf3be57.tar.gz
make errorbars work with multibars
the current logic didn't support multi-bar graphs and charted the error on the edge of a bar. This caused error bars to get overlapped and made it impossible to read things. The new change offset the error bar to the center of its bar
-rw-r--r--android_benchmark_views_app/static/js/jquery.flot.errorbars.js12
1 files changed, 6 insertions, 6 deletions
diff --git a/android_benchmark_views_app/static/js/jquery.flot.errorbars.js b/android_benchmark_views_app/static/js/jquery.flot.errorbars.js
index aa35772..78da89a 100644
--- a/android_benchmark_views_app/static/js/jquery.flot.errorbars.js
+++ b/android_benchmark_views_app/static/js/jquery.flot.errorbars.js
@@ -152,7 +152,7 @@ rui (dot) pereira (at) gmail (dot) com
return errRanges;
}
- function drawSeriesErrors(plot, ctx, s){
+ function drawSeriesErrors(plot, ctx, multibarIdx, s){
var points = s.datapoints.points,
ps = s.datapoints.pointsize,
@@ -234,10 +234,10 @@ rui (dot) pereira (at) gmail (dot) com
}
// convert to pixels
- x = ax[0].p2c(x),
- y = ax[1].p2c(y),
- upper = ax[e].p2c(upper);
- lower = ax[e].p2c(lower);
+ x = ax[0].p2c(x+(multibarIdx*s.bars.barWidth)-s.bars.barWidth/2),
+ y = ax[1].p2c(y),
+ upper = ax[e].p2c(upper);
+ lower = ax[e].p2c(lower);
minmax[0] = ax[e].p2c(minmax[0]);
minmax[1] = ax[e].p2c(minmax[1]);
@@ -327,7 +327,7 @@ rui (dot) pereira (at) gmail (dot) com
ctx.translate(plotOffset.left, plotOffset.top);
$.each(plot.getData(), function (i, s) {
if (s.points.errorbars && (s.points.xerr.show || s.points.yerr.show))
- drawSeriesErrors(plot, ctx, s);
+ drawSeriesErrors(plot, ctx, i, s);
});
ctx.restore();
}