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

Side by Side Diff: packages/charted/lib/locale/format/number_format.dart

Issue 2989763002: Update charted to 0.4.8 and roll (Closed)
Patch Set: Removed Cutch from list of reviewers Created 3 years, 4 months 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 unified diff | Download patch
« no previous file with comments | « packages/charted/lib/core/utils/lists.dart ('k') | packages/charted/lib/svg/axis.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2014 Google Inc. All rights reserved. 2 * Copyright 2014 Google Inc. All rights reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style 4 * Use of this source code is governed by a BSD-style
5 * license that can be found in the LICENSE file or at 5 * license that can be found in the LICENSE file or at
6 * https://developers.google.com/open-source/licenses/bsd 6 * https://developers.google.com/open-source/licenses/bsd
7 */ 7 */
8 part of charted.locale.format; 8 part of charted.locale.format;
9 9
10 /** 10 /**
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
134 } else if (type == 'e' || type == 'f') { 134 } else if (type == 'e' || type == 'f') {
135 precision = math.max(0, math.min(20, precision)); 135 precision = math.max(0, math.min(20, precision));
136 } 136 }
137 } 137 }
138 138
139 NumberFormatFunction formatFunction = _getFormatFunction(type); 139 NumberFormatFunction formatFunction = _getFormatFunction(type);
140 140
141 var zcomma = (zfill != null) && comma; 141 var zcomma = (zfill != null) && comma;
142 142
143 return (value) { 143 return (value) {
144 if (value == null) return '-';
144 var fullSuffix = suffix; 145 var fullSuffix = suffix;
145 146
146 // Return the empty string for floats formatted as ints. 147 // Return the empty string for floats formatted as ints.
147 if (integer && (value % 1) > 0) return ''; 148 if (integer && (value % 1) > 0) return '';
148 149
149 // Convert negative to positive, and record the sign prefix. 150 // Convert negative to positive, and record the sign prefix.
150 var negative; 151 var negative;
151 if (value < 0 || value == 0 && 1 / value < 0) { 152 if (value < 0 || value == 0 && 1 / value < 0) {
152 value = -value; 153 value = -value;
153 negative = '-'; 154 negative = '-';
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
239 case 'e': 240 case 'e':
240 return (num x, [int p = 0]) => x.toStringAsExponential(p); 241 return (num x, [int p = 0]) => x.toStringAsExponential(p);
241 case 'f': 242 case 'f':
242 return (num x, [int p = 0]) => x.toStringAsFixed(p); 243 return (num x, [int p = 0]) => x.toStringAsFixed(p);
243 case 'r': 244 case 'r':
244 default: 245 default:
245 return (num x, [int p = 0]) => x.toString(); 246 return (num x, [int p = 0]) => x.toString();
246 } 247 }
247 } 248 }
248 } 249 }
OLDNEW
« no previous file with comments | « packages/charted/lib/core/utils/lists.dart ('k') | packages/charted/lib/svg/axis.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698