From: Dan Vanderkam Date: Sat, 28 Mar 2015 18:18:44 +0000 (-0400) Subject: Test labelsKMB{B,G2} with values < 1 X-Git-Tag: v2.0.0~66^2~8 X-Git-Url: https://adrianiainlam.tk/git/?a=commitdiff_plain;h=a681c4cbf8d69e8f67d4a1947be5526d98f0d34c;p=dygraphs.git Test labelsKMB{B,G2} with values < 1 --- diff --git a/auto_tests/tests/axis_labels.js b/auto_tests/tests/axis_labels.js index 89959ac..7655213 100644 --- a/auto_tests/tests/axis_labels.js +++ b/auto_tests/tests/axis_labels.js @@ -619,6 +619,55 @@ it('testLabelKMG2_top', function() { Util.getYLabels()); }); +it('testSmallLabelKMB', function() { + var data = []; + data.push([0, 0]); + data.push([1, 1e-6]); + data.push([2, 2e-6]); + + var g = new Dygraph( + document.getElementById("graph"), + data, + { + labels: [ 'X', 'bar' ], + axes : { + y: { + labelsKMB: true + } + } + } + ); + + // TODO(danvk): use prefixes here (e.g. m, µ, n) + assert.deepEqual(['0', '5.00e-7', '1.00e-6', '1.50e-6', '2.00e-6'], + Util.getYLabels()); +}); + +it('testSmallLabelKMG2', function() { + var data = []; + data.push([0, 0]); + data.push([1, 1e-6]); + data.push([2, 2e-6]); + + var g = new Dygraph( + document.getElementById("graph"), + data, + { + labels: [ 'X', 'bar' ], + axes : { + y: { + labelsKMG2: true + } + } + } + ); + + // TODO(danvk): this is strange--the values aren't on powers of two, and are + // these units really used for powers of two in <1? + assert.deepEqual(['0', '0.48u', '0.95u', '1.43u', '1.91u'], + Util.getYLabels()); +}); + /** * Verify that log scale axis range is properly specified. */