From: Dan Vanderkam Date: Sun, 13 Dec 2009 18:54:17 +0000 (-0800) Subject: apply patch one from ComSubVie X-Git-Tag: v1.0.0~798 X-Git-Url: https://adrianiainlam.tk/git/?a=commitdiff_plain;h=afefbcdb3f09645ad94400ec119db5cd92c14fd1;hp=1bce597191839ef2e56ecba0bf7be1e60209a5c6;p=dygraphs.git apply patch one from ComSubVie --- diff --git a/dygraph.js b/dygraph.js index a2048d3..08ff8ae 100644 --- a/dygraph.js +++ b/dygraph.js @@ -91,6 +91,7 @@ Dygraph.DEFAULT_ATTRS = { }, labelsSeparateLines: false, labelsKMB: false, + labelsKMG2: false, strokeWidth: 1.0, @@ -1061,6 +1062,15 @@ Dygraph.numericTicks = function(minV, maxV, self) { } else if (tickV >= k) { label = self.round_(tickV/k, 1) + "K"; } + } else if (self.attr_("labelsKMG2")) { + var k = 1024; + if (tickV >= k*k*k) { + label = self.round_(tickV/(k*k*k), 1) + "G"; + } else if (tickV >= k*k) { + label = self.round_(tickV/(k*k), 1) + "M"; + } else if (tickV >= k) { + label = self.round_(tickV/k, 1) + "k"; + } } ticks.push( {label: label, v: tickV} ); }