[247.5, 152.02209814465604]],
{ fillStyle: "#00ff00" });
};
+
+CustomBarsTestCase.prototype.testCustomBarsWithNegativeValuesInLogScale =
+ function() {
+ var graph = document.getElementById("graph");
+
+ var count = 0;
+ var drawPointCallback = function() {
+ count++;
+ };
+
+ var g = new Dygraph(graph,
+ [
+ [1, [10, 20,30]],
+ [2, [5, 10, 15]],
+ [3, [-1, 5, 10]]
+ ],
+ {
+ drawPoints: true,
+ drawPointCallback : drawPointCallback,
+ customBars: true
+ });
+
+ // Normally all three points would be drawn.
+ assertEquals(3, count);
+ count = 0;
+
+ // In log scale, the third point shouldn't be shown.
+ g.updateOptions({ logscale : true });
+ assertEquals(2, count);
+};
};
GridPerAxisTestCase.prototype.testGridLinePattern = function() {
var opts = {
- width : 480,
+ width : 120,
height : 320,
errorBars : false,
drawXGrid : false,
}
var x, y;
// Step through all gridlines of the axis
- for ( var i = 0; i < yGridlines.length; i++) {
+ for (var i = 0; i < yGridlines.length; i++) {
y = halfDown(g.toDomYCoord(yGridlines[i], 0));
// Step through the pixels of the line and test the pattern.
for (x = halfUp(g.plotter_.area.x); x < g.plotter_.area.w; x++) {
var pattern = (Math.floor((x) / 10)) % 2;
switch (pattern) {
case 0: // fill
- assertEquals("Unexpected filled grid-pattern color found at pixel: x: " + x + "y: "
+ assertEquals("Unexpected filled grid-pattern color found at pixel: x: " + x + " y: "
+ y, [ 0, 0, 255 ], drawnPixel);
break;
case 1: // no fill
- assertEquals("Unexpected empty grid-pattern color found at pixel: x: " + x + "y: "
+ assertEquals("Unexpected empty grid-pattern color found at pixel: x: " + x + " y: "
+ y, [ 0, 0, 0 ], drawnPixel);
break;
}
};
// Compute the box which the chart should be drawn in. This is the canvas's
-// box, less space needed for axis and chart labels.
+// box, less space needed for axis, chart labels, and other plug-ins.
// NOTE: This should only be called by Dygraph.predraw_().
DygraphLayout.prototype.computePlotArea = function() {
var area = {
this.yAxes_ = yAxes;
};
-DygraphLayout.prototype.setDateWindow = function(dateWindow) {
- this.dateWindow_ = dateWindow;
-};
-
DygraphLayout.prototype.evaluate = function() {
this._evaluateLimits();
this._evaluateLineCharts();
// Save the X axis zoomed status as the updateOptions call will tend to set it erroneously
var tmp_zoomed_x = this.zoomed_x_;
// Tell PlotKit to use this new data and render itself
- this.layout_.setDateWindow(this.dateWindow_);
this.zoomed_x_ = tmp_zoomed_x;
this.layout_.evaluateWithError();
this.renderGraph_(is_initial_draw);
if (logScale) {
// On the log scale, points less than zero do not exist.
// This will create a gap in the chart.
- if (point <= 0) {
+ if (errorBars || customBars) {
+ // point.length is either 2 (errorBars) or 3 (customBars)
+ for (var k = 0; k < point.length; k++) {
+ if (point[k] <= 0) {
+ point = null;
+ break;
+ }
+ }
+ } else if (point <= 0) {
point = null;
}
}
// Fix null points to fit the display type standard.
- if(point !== null) {
+ if (point !== null) {
series.push([x, point]);
} else {
series.push([x, errorBars ? [null, null] : customBars ? [null, null, null] : point]);