* Altered formatting to use the shorter of floatFormat() or intFormat(). This
authorJeremy Brewer <jeremy.d.brewer@gmail.com>
Fri, 4 Feb 2011 21:15:43 +0000 (16:15 -0500)
committerJeremy Brewer <jeremy.d.brewer@gmail.com>
Fri, 4 Feb 2011 21:15:43 +0000 (16:15 -0500)
  seems to fix all of the known formatting problems.

dygraph.js

index 14b4994..1257b23 100644 (file)
@@ -149,7 +149,11 @@ Dygraph.DEFAULT_ATTRS = {
   labelsKMG2: false,
   showLabelsOnHighlight: true,
 
-  yValueFormatter: Dygraph.floatFormat,
+  yValueFormatter: function(x, opt_precision) {
+    var s = Dygraph.floatFormat(x, opt_precision);
+    var s2 = Dygraph.intFormat(x);
+    return s.length <= s2.length ? s : s2;
+  },
 
   strokeWidth: 1.0,