X-Git-Url: https://adrianiainlam.tk/git/?a=blobdiff_plain;f=auto_tests%2Ftests%2Faxis_labels.js;h=54c02076b21aeef4f8ea01671369c4db3fd7f122;hb=74934c8399f3ae7ba8141049680f270fb9697196;hp=e50b002f25755ec20bf45eaae278e89dced8626d;hpb=94647da23ed251ba0f1da8d155d2552680a4e9cf;p=dygraphs.git diff --git a/auto_tests/tests/axis_labels.js b/auto_tests/tests/axis_labels.js index e50b002..54c0207 100644 --- a/auto_tests/tests/axis_labels.js +++ b/auto_tests/tests/axis_labels.js @@ -206,7 +206,7 @@ AxisLabelsTestCase.prototype.testDateAxisLabelFormatter = function () { assertEquals('number', typeof(granularity)); assertEquals('function', typeof(opts)); assertEquals('[Dygraph graph]', dg.toString()); - return 'x' + x.strftime('%Y/%m/%d'); + return 'x' + Util.formatDate(x); } }, y : { @@ -228,7 +228,7 @@ AxisLabelsTestCase.prototype.testDateAxisLabelFormatter = function () { var graph = document.getElementById("graph"); var g = new Dygraph(graph, data, opts); - assertEquals(["x2011/01/01", "x2011/01/02", "x2011/01/03", "x2011/01/04", "x2011/01/05", "x2011/01/06", "x2011/01/07", "x2011/01/08", "x2011/01/09"], Util.getXLabels()); + assertEquals(["x2011/01/01", "x2011/01/02", "x2011/01/03", "x2011/01/04", "x2011/01/05", "x2011/01/06", "x2011/01/07", "x2011/01/08"], Util.getXLabels()); assertEquals(['y2','y4','y6','y8','y10','y12','y14','y16','y18'], Util.getYLabels()); g.setSelection(0); @@ -292,7 +292,7 @@ AxisLabelsTestCase.prototype.testDateValueFormatter = function () { assertEquals('function', typeof(opts)); assertEquals('string', typeof(series_name)); assertEquals('[Dygraph graph]', dg.toString()); - return 'x' + new Date(x).strftime('%Y/%m/%d'); + return 'x' + Util.formatDate(x); } }, y : { @@ -316,7 +316,7 @@ AxisLabelsTestCase.prototype.testDateValueFormatter = function () { var g = new Dygraph(graph, data, opts); // valueFormatters do not affect ticks. - assertEquals(['01Jan','02Jan','03Jan','04Jan','05Jan','06Jan','07Jan','08Jan','09Jan'], Util.getXLabels()); + assertEquals(['01Jan','02Jan','03Jan','04Jan','05Jan','06Jan','07Jan','08Jan'], Util.getXLabels()); assertEquals(['2','4','6','8','10','12','14','16','18'], Util.getYLabels()); // the valueFormatter options also affect the legend. @@ -741,11 +741,12 @@ AxisLabelsTestCase.prototype.testLabelsKMBPerAxis = function() { x: { labelsKMB: true } }, series: { - b: { axis: "y2" }, + b: { axis: "y2" } } }); // labelsKMB doesn't apply to the x axis. This value should be different. + // BUG : https://code.google.com/p/dygraphs/issues/detail?id=488 assertEquals(["1000", "1500", "2000", "2500", "3000", "3500"], Util.getXLabels()); assertEquals( ["0","500","1000","1500","2000"], Util.getYLabels(1)); assertEquals(["0","500","1K","1.5K","2K"], Util.getYLabels(2)); @@ -768,13 +769,14 @@ AxisLabelsTestCase.prototype.testLabelsKMBG2IPerAxis = function() { x: { labelsKMG2: true } }, series: { - b: { axis: "y2" }, + b: { axis: "y2" } } }); // It is weird that labelsKMG2 does something on the x axis but KMB does not. // Plus I can't be sure they're doing the same thing as they're done in different // bits of code. + // BUG : https://code.google.com/p/dygraphs/issues/detail?id=488 assertEquals(["1024","1536","2048","2560","3072","3584"], Util.getXLabels()); assertEquals( ["0","500","1000","1500","2000"], Util.getYLabels(1)); assertEquals(["0","500","1000","1.46k","1.95k"], Util.getYLabels(2)); @@ -797,11 +799,12 @@ AxisLabelsTestCase.prototype.testSigFigsPerAxis = function() { x: { sigFigs: 8 } }, series: { - b: { axis: "y2" }, + b: { axis: "y2" } } }); // sigFigs doesn't apply to the x axis. This value should be different. + // BUG : https://code.google.com/p/dygraphs/issues/detail?id=488 assertEquals(["1000","1500","2000","2500","3000","3500"], Util.getXLabels()); assertEquals(["0.0","5.0e+2","1.0e+3","1.5e+3","2.0e+3"], Util.getYLabels(1)); assertEquals(["0.00000","500.000","1000.00","1500.00","2000.00"], Util.getYLabels(2)); @@ -820,7 +823,7 @@ AxisLabelsTestCase.prototype.testDigitsAfterDecimalPerAxis = function() { "0.009,0.004,0.005\n", { digitsAfterDecimal: 1, series: { - b: { axis: "y2" }, + b: { axis: "y2" } } }); @@ -845,6 +848,7 @@ AxisLabelsTestCase.prototype.testDigitsAfterDecimalPerAxis = function() { // digitsAfterDecimal is ignored for the x-axis. + // BUG : https://code.google.com/p/dygraphs/issues/detail?id=488 g.updateOptions({ axes: { x: { digitsAfterDecimal: 3 }}}); assertEquals(["0.006","0.006500000000000001","0.007","0.0075","0.008","0.0085"], Util.getXLabels()); g.updateOptions({ axes: { x: { digitsAfterDecimal: 4 }}}); @@ -868,10 +872,10 @@ AxisLabelsTestCase.prototype.testMaxNumberWidthPerAxis = function() { "12404,12604,12801\n", { maxNumberWidth: 1, series: { - b: { axis: "y2" }, + b: { axis: "y2" } } }); -fail = function(x) {console.log(x)}; + g.updateOptions({ axes: { y: { maxNumberWidth: 4 }}}); assertEquals(["1.26e+4","1.26e+4","1.26e+4","1.26e+4","1.26e+4","1.26e+4","1.26e+4"] , Util.getYLabels(1)); g.updateOptions({ axes: { y: { maxNumberWidth: 5 }}}); @@ -887,6 +891,7 @@ fail = function(x) {console.log(x)}; assertEquals(["1.28e+4","1.28e+4","1.28e+4","1.28e+4","1.28e+4","1.28e+4","1.28e+4"], Util.getYLabels(2)); // maxNumberWidth is ignored for the x-axis. + // BUG : https://code.google.com/p/dygraphs/issues/detail?id=488 g.updateOptions({ axes: { x: { maxNumberWidth: 4 }}}); assertEquals(["12401","12401.5","12402","12402.5","12403","12403.5"], Util.getXLabels()); g.updateOptions({ axes: { x: { maxNumberWidth: 5 }}});