* @fileoverview Regression test based on some strange customBars data.
* @author danvk@google.com (Dan Vanderkam)
*/
+import Dygraph from '../../src/dygraph';
+import * as utils from '../../src/dygraph-utils';
+import CanvasAssertions from './CanvasAssertions';
+import PixelSampler from './PixelSampler';
+import Proxy from './Proxy';
+
describe("custom-bars", function() {
-var _origFunc = Dygraph.getContext;
+cleanupAfterEach();
+
+var _origFunc = utils.getContext;
beforeEach(function() {
- document.body.innerHTML = "<div id='graph'></div>";
- Dygraph.getContext = function(canvas) {
+ utils.getContext = function(canvas) {
return new Proxy(_origFunc(canvas));
}
});
afterEach(function() {
- Dygraph.getContext = _origFunc;
+ utils.getContext = _origFunc;
});
// This test used to reliably produce an infinite loop.
width: 500, height: 350,
customBars: true,
errorBars: true,
- axes : {
- x : {
+ axes: {
+ x: {
drawGrid: false,
drawAxis: false,
},
- y : {
+ y: {
drawGrid: false,
drawAxis: false,
}
},
valueRange: [0, 120],
fillAlpha: 0.15,
- colors: [ '#00FF00' ]
+ colors: ['#00FF00'],
+ labels: ['X', 'Y']
});
var sampler = new PixelSampler(g);
},
fillAlpha: 1.0,
logscale: true,
- colors: [ '#00FF00' ]
+ colors: ['#00FF00'],
+ labels: ['X', 'Y']
});
// The following assertions describe the sides of the custom bars, which are
],
{
drawPoints: true,
- drawPointCallback : drawPointCallback,
- customBars: true
+ drawPointCallback: drawPointCallback,
+ customBars: true,
+ labels: ['X', 'Y']
});
// Normally all three points would be drawn.