Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(9)

Unified Diff: packages/charted/lib/locale/format.dart

Issue 1521693002: Roll Observatory deps (charted -> ^0.3.0) (Closed) Base URL: https://chromium.googlesource.com/external/github.com/dart-lang/observatory_pub_packages.git@master
Patch Set: Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: packages/charted/lib/locale/format.dart
diff --git a/packages/charted/lib/locale/format.dart b/packages/charted/lib/locale/format.dart
index 64b4396a6a732245278801c942d957f825398e7e..a61c405734657488ee0c909bcc570a333fcf59dd 100644
--- a/packages/charted/lib/locale/format.dart
+++ b/packages/charted/lib/locale/format.dart
@@ -35,14 +35,30 @@ FormatFunction format(String specifier, [Locale locale = null]) {
return locale.numberFormat.format(specifier);
}
-
/*
* Class for computing the SI format prefix for the given value.
*/
class FormatPrefix {
// SI scale units in increments of 1000.
- static const List unitPrefixes = const
- ["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];
+ static const List unitPrefixes = const [
+ "y",
+ "z",
+ "a",
+ "f",
+ "p",
+ "n",
+ "µ",
+ "m",
+ "",
+ "k",
+ "M",
+ "G",
+ "T",
+ "P",
+ "E",
+ "Z",
+ "Y"
+ ];
Function _scale;
String _symbol;
@@ -58,8 +74,7 @@ class FormatPrefix {
// Determining SI scale of the value in increment of 1000.
i = 1 + (1e-12 + math.log(value) / math.LN10).floor();
- i = math.max(-24, math.min(24,
- ((i - 1) / 3).floor() * 3));
+ i = math.max(-24, math.min(24, ((i - 1) / 3).floor() * 3));
i = 8 + (i / 3).floor();
// Sets the scale and symbol of the value.
@@ -74,8 +89,7 @@ class FormatPrefix {
/** Returns the value of x rounded to the nth digit. */
_roundToPrecision(num x, num n) {
- return n != 0 ?
- (x * (n = math.pow(10, n))).round() / n : x.round();
+ return n != 0 ? (x * (n = math.pow(10, n))).round() / n : x.round();
}
/** Returns the SI prefix for the value. */
« no previous file with comments | « packages/charted/lib/layout/src/treemap_layout.dart ('k') | packages/charted/lib/locale/format/number_format.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698