// TODO(danvk): here
if (stepPlot) {
- var newYs = [ prevY - point.errorPlus * yscale,
- prevY + point.errorMinus * yscale ];
+ var newYs = [ point.y_bottom, point.y_top ];
prevY = point.y;
} else {
- var newYs = [ point.y - point.errorPlus * yscale,
- point.y + point.errorMinus * yscale ];
+ var newYs = [ point.y_bottom, point.y_top ];
}
newYs[0] = this.area.h * newYs[0] + this.area.y;
newYs[1] = this.area.h * newYs[1] + this.area.y;
}
};
+DygraphLayout._calcYNormal = function(axis, value) {
+ if (axis.logscale) {
+ return 1.0 - ((Dygraph.log10(value) - Dygraph.log10(axis.minyval)) * axis.ylogscale);
+ } else {
+ return 1.0 - ((value - axis.minyval) * axis.yscale);
+ }
+};
+
DygraphLayout.prototype._evaluateLineCharts = function() {
// add all the rects
this.points = new Array();
var xValue = parseFloat(dataset[j][0]);
var yValue = parseFloat(dataset[j][1]);
- // Range from 0-1 where 0 represents top and 1 represents bottom
- var xNormal = (xValue - this.minxval) * this.xscale;
// Range from 0-1 where 0 represents left and 1 represents right.
- var yNormal;
- if (axis.logscale) {
- yNormal = 1.0 - ((Dygraph.log10(yValue) - Dygraph.log10(axis.minyval)) * axis.ylogscale);
- } else {
- yNormal = 1.0 - ((yValue - axis.minyval) * axis.yscale);
- }
+ var xNormal = (xValue - this.minxval) * this.xscale;
+ // Range from 0-1 where 0 represents top and 1 represents bottom
+ var yNormal = DygraphLayout._calcYNormal(axis, yValue);
+
var point = {
// TODO(danvk): here
x: xNormal,
if (!this.datasets.hasOwnProperty(setName)) continue;
var j = 0;
var dataset = this.datasets[setName];
+ var axis = this.dygraph_.axisPropertiesForSeries(setName);
for (var j = 0; j < dataset.length; j++, i++) {
var item = dataset[j];
var xv = parseFloat(item[0]);
if (xv == this.points[i].xval &&
yv == this.points[i].yval) {
- this.points[i].errorMinus = parseFloat(item[2]);
- this.points[i].errorPlus = parseFloat(item[3]);
+ var errorMinus = parseFloat(item[2]);
+ var errorPlus = parseFloat(item[3]);
+
+ var yv_minus = yv - errorMinus;
+ var yv_plus = yv + errorPlus;
+ this.points[i].y_top = DygraphLayout._calcYNormal(axis, yv_minus);
+ this.points[i].y_bottom = DygraphLayout._calcYNormal(axis, yv_plus);
}
}
}