projects
/
dygraphs.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Fixed bug when graph is zoomed
[dygraphs.git]
/
dygraph-canvas.js
diff --git
a/dygraph-canvas.js
b/dygraph-canvas.js
index
70998bd
..
979688d
100644
(file)
--- a/
dygraph-canvas.js
+++ b/
dygraph-canvas.js
@@
-85,9
+85,7
@@
DygraphLayout.prototype._evaluateLineCharts = function() {
if (point.y >= 1.0) {
point.y = 1.0;
}
if (point.y >= 1.0) {
point.y = 1.0;
}
- if ((point.x >= 0.0) && (point.x <= 1.0)) {
- this.points.push(point);
- }
+ this.points.push(point);
}
}
};
}
}
};
@@
-189,6
+187,7
@@
DygraphCanvasRenderer = function(dygraph, element, layout, options) {
"drawXGrid": true,
"gridLineColor": "rgb(128,128,128)",
"fillAlpha": 0.15,
"drawXGrid": true,
"gridLineColor": "rgb(128,128,128)",
"fillAlpha": 0.15,
+ "underlayCallback": null
};
Dygraph.update(this.options, options);
};
Dygraph.update(this.options, options);
@@
-278,6
+277,11
@@
DygraphCanvasRenderer.isSupported = function(canvasName) {
DygraphCanvasRenderer.prototype.render = function() {
// Draw the new X/Y grid
var ctx = this.element.getContext("2d");
DygraphCanvasRenderer.prototype.render = function() {
// Draw the new X/Y grid
var ctx = this.element.getContext("2d");
+
+ if (this.options.underlayCallback) {
+ this.options.underlayCallback(ctx, this.area, this.layout);
+ }
+
if (this.options.drawYGrid) {
var ticks = this.layout.yticks;
ctx.save();
if (this.options.drawYGrid) {
var ticks = this.layout.yticks;
ctx.save();
@@
-484,7
+488,7
@@
DygraphCanvasRenderer.prototype._renderLineChart = function() {
ctx.save();
ctx.strokeStyle = color;
ctx.lineWidth = this.options.strokeWidth;
ctx.save();
ctx.strokeStyle = color;
ctx.lineWidth = this.options.strokeWidth;
- var prevX =
-1
;
+ var prevX =
NaN
;
var prevYs = [-1, -1];
var count = 0;
var yscale = this.layout.yscale;
var prevYs = [-1, -1];
var count = 0;
var yscale = this.layout.yscale;
@@
-499,7
+503,7
@@
DygraphCanvasRenderer.prototype._renderLineChart = function() {
count++;
if (point.name == setName) {
if (!isOK(point.y)) {
count++;
if (point.name == setName) {
if (!isOK(point.y)) {
- prevX =
-1
;
+ prevX =
NaN
;
continue;
}
// TODO(danvk): here
continue;
}
// TODO(danvk): here
@@
-507,7
+511,7
@@
DygraphCanvasRenderer.prototype._renderLineChart = function() {
point.y + point.errorMinus * yscale ];
newYs[0] = this.area.h * newYs[0] + this.area.y;
newYs[1] = this.area.h * newYs[1] + this.area.y;
point.y + point.errorMinus * yscale ];
newYs[0] = this.area.h * newYs[0] + this.area.y;
newYs[1] = this.area.h * newYs[1] + this.area.y;
- if (
prevX >= 0
) {
+ if (
!isNaN(prevX)
) {
ctx.moveTo(prevX, prevYs[0]);
ctx.lineTo(point.canvasx, newYs[0]);
ctx.lineTo(point.canvasx, newYs[1]);
ctx.moveTo(prevX, prevYs[0]);
ctx.lineTo(point.canvasx, newYs[0]);
ctx.lineTo(point.canvasx, newYs[1]);
@@
-533,7
+537,7
@@
DygraphCanvasRenderer.prototype._renderLineChart = function() {
ctx.save();
ctx.strokeStyle = color;
ctx.lineWidth = this.options.strokeWidth;
ctx.save();
ctx.strokeStyle = color;
ctx.lineWidth = this.options.strokeWidth;
- var prevX =
-1
;
+ var prevX =
NaN
;
var prevYs = [-1, -1];
var count = 0;
var yscale = this.layout.yscale;
var prevYs = [-1, -1];
var count = 0;
var yscale = this.layout.yscale;
@@
-548,7
+552,7
@@
DygraphCanvasRenderer.prototype._renderLineChart = function() {
count++;
if (point.name == setName) {
if (!isOK(point.y)) {
count++;
if (point.name == setName) {
if (!isOK(point.y)) {
- prevX =
-1
;
+ prevX =
NaN
;
continue;
}
var pX = 1.0 + this.layout.minyval * this.layout.yscale;
continue;
}
var pX = 1.0 + this.layout.minyval * this.layout.yscale;
@@
-557,7
+561,7
@@
DygraphCanvasRenderer.prototype._renderLineChart = function() {
var newYs = [ point.y, pX ];
newYs[0] = this.area.h * newYs[0] + this.area.y;
newYs[1] = this.area.h * newYs[1] + this.area.y;
var newYs = [ point.y, pX ];
newYs[0] = this.area.h * newYs[0] + this.area.y;
newYs[1] = this.area.h * newYs[1] + this.area.y;
- if (
prevX >= 0
) {
+ if (
!isNaN(prevX)
) {
ctx.moveTo(prevX, prevYs[0]);
ctx.lineTo(point.canvasx, newYs[0]);
ctx.lineTo(point.canvasx, newYs[1]);
ctx.moveTo(prevX, prevYs[0]);
ctx.lineTo(point.canvasx, newYs[0]);
ctx.lineTo(point.canvasx, newYs[1]);