2 * @fileoverview Tests input data which uses scientific notation.
3 * This is a regression test for
4 * http://code.google.com/p/dygraphs/issues/detail?id=186
6 * @author danvk@google.com (Dan Vanderkam)
8 var scientificNotationTestCase
= TestCase("scientific-notation");
10 scientificNotationTestCase
.prototype.setUp
= function() {
11 document
.body
.innerHTML
= "<div id='graph'></div>";
14 scientificNotationTestCase
.prototype.tearDown
= function() {
17 function getXValues(g
) {
19 for (var i
= 0; i
< g
.numRows(); i
++) {
20 xs
.push(g
.getValue(i
, 0));
25 scientificNotationTestCase
.prototype.testScientificInput
= function() {
33 var graph
= document
.getElementById("graph");
34 var g
= new Dygraph(graph
, data
, {});
35 assertEqualsDelta([10, 20, 30, 40], getXValues(g
), 1e-6);
38 scientificNotationTestCase
.prototype.testScientificInputPlus
= function() {
46 var graph
= document
.getElementById("graph");
47 var g
= new Dygraph(graph
, data
, {});
48 assertEqualsDelta([10, 20, 30, 40], getXValues(g
), 1e-6);
51 scientificNotationTestCase
.prototype.testScientificInputMinus
= function() {
59 var graph
= document
.getElementById("graph");
60 var g
= new Dygraph(graph
, data
, {});
61 assertEqualsDelta([0.1, 0.2, 0.3, 0.4], getXValues(g
), 1e-6);
64 scientificNotationTestCase
.prototype.testScientificInputMinusCap
= function() {
72 var graph
= document
.getElementById("graph");
73 var g
= new Dygraph(graph
, data
, {});
74 assertEqualsDelta([0.1, 0.2, 0.3, 0.4], getXValues(g
), 1e-6);