X-Git-Url: https://adrianiainlam.tk/git/?a=blobdiff_plain;f=auto_tests%2Ftests%2Faxis_labels.js;fp=auto_tests%2Ftests%2Faxis_labels.js;h=7655213c282c63fe8b1c8659369caf1cce74196c;hb=a681c4cbf8d69e8f67d4a1947be5526d98f0d34c;hp=89959ac9fe08240e5a98dfdb55d391f742447569;hpb=61a098491127963d2c9a143b0a18c6a85d5d284c;p=dygraphs.git 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. */