-beforeEach(function() {
- document.body.innerHTML = "<div id='graph'></div>";
-});
+import Dygraph from '../../src/dygraph';
+import * as utils from '../../src/dygraph-utils';
+import DEFAULT_ATTRS from '../../src/dygraph-default-attrs';
+import Util from './Util';
+import {assertDeepCloseTo} from './custom_asserts';
};
var data = [[5.0,0],[5.1,1],[5.2,2],[5.3,3],[5.4,4],[5.5,5],[5.6,6],[5.7,7],[5.8,8],[5.9,9]];
var graph = document.getElementById("graph");
};
var data = [[5.0,0],[5.1,1],[5.2,2],[5.3,3],[5.4,4],[5.5,5],[5.6,6],[5.7,7],[5.8,8],[5.9,9]];
var graph = document.getElementById("graph");
x : {
pixelsPerLabel: 60,
axisLabelFormatter : function(x, granularity, opts, dg) {
x : {
pixelsPerLabel: 60,
axisLabelFormatter : function(x, granularity, opts, dg) {
assert.equal('number', typeof(granularity));
assert.equal('function', typeof(opts));
assert.equal('[Dygraph graph]', dg.toString());
assert.equal('number', typeof(granularity));
assert.equal('function', typeof(opts));
assert.equal('[Dygraph graph]', dg.toString());
assert.deepEqual(['0', '0.48u', '0.95u', '1.43u', '1.91u'],
Util.getYLabels());
});
assert.deepEqual(['0', '0.48u', '0.95u', '1.43u', '1.91u'],
Util.getYLabels());
});
* Verify that log scale axis range is properly specified.
*/
it('testLogScale', function() {
* Verify that log scale axis range is properly specified.
*/
it('testLogScale', function() {
- var g = new Dygraph("graph", [[0, 5], [1, 1000]], { logscale : true });
+ var g = new Dygraph("graph",
+ [[0, 5], [1, 1000]], {
+ logscale: true,
+ labels: ['X', 'Y']
+ });
var nonEmptyLabels = Util.getYLabels().filter(function(x) { return x.length > 0; });
assert.deepEqual(["5","10","20","50","100","200","500","1000"], nonEmptyLabels);
var nonEmptyLabels = Util.getYLabels().filter(function(x) { return x.length > 0; });
assert.deepEqual(["5","10","20","50","100","200","500","1000"], nonEmptyLabels);
* Verify that include zero range is properly specified.
*/
it('testIncludeZero', function() {
* Verify that include zero range is properly specified.
*/
it('testIncludeZero', function() {
- var g = new Dygraph("graph", [[0, 500], [1, 1000]], { includeZero : true });
+ var g = new Dygraph("graph",
+ [[0, 500], [1, 1000]], {
+ includeZero: true,
+ labels: ['X', 'Y1']
+ });
assert.deepEqual(['0','200','400','600','800','1000'], Util.getYLabels());
g.updateOptions({ includeZero : false });
assert.deepEqual(['0','200','400','600','800','1000'], Util.getYLabels());
g.updateOptions({ includeZero : false });
var g = new Dygraph(graph, simpleData, {});
// Be sure we're dealing with a 14-point default.
var g = new Dygraph(graph, simpleData, {});
// Be sure we're dealing with a 14-point default.
var assertFontSize = function(selector, expected) {
Util.assertStyleOfChildren(selector, "font-size", expected);
}
var assertFontSize = function(selector, expected) {
Util.assertStyleOfChildren(selector, "font-size", expected);
}
assertFontSize(document.querySelectorAll(".dygraph-axis-label-x"), "8px");
assertFontSize(document.querySelectorAll(".dygraph-axis-label-y"), "8px");
g.updateOptions({
axisLabelFontSize : null,
assertFontSize(document.querySelectorAll(".dygraph-axis-label-x"), "8px");
assertFontSize(document.querySelectorAll(".dygraph-axis-label-y"), "8px");
g.updateOptions({
axisLabelFontSize : null,
assertFontSize(document.querySelectorAll(".dygraph-axis-label-x"), "14px");
assertFontSize(document.querySelectorAll(".dygraph-axis-label-y"), "14px");
assertFontSize(document.querySelectorAll(".dygraph-axis-label-x"), "14px");
assertFontSize(document.querySelectorAll(".dygraph-axis-label-y"), "14px");
var g = new Dygraph(graph, simpleData, {});
// Be sure we're dealing with a black default.
var g = new Dygraph(graph, simpleData, {});
// Be sure we're dealing with a black default.
var assertColor = function(selector, expected) {
Util.assertStyleOfChildren(selector, "color", expected);
var assertColor = function(selector, expected) {
Util.assertStyleOfChildren(selector, "color", expected);
assertColor(document.querySelectorAll(".dygraph-axis-label-x"), "rgb(0, 0, 0)");
assertColor(document.querySelectorAll(".dygraph-axis-label-y"), "rgb(0, 0, 0)");
assertColor(document.querySelectorAll(".dygraph-axis-label-x"), "rgb(0, 0, 0)");
assertColor(document.querySelectorAll(".dygraph-axis-label-y"), "rgb(0, 0, 0)");