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

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

Issue 2213693002: Updated charted DEP to 0.4.X (Closed) Base URL: https://github.com/dart-lang/observatory_pub_packages.git@master
Patch Set: Created 4 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
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 168 matching lines...) Expand 10 before | Expand all | Expand 10 after
179 var i = value.lastIndexOf('.'), 179 var i = value.lastIndexOf('.'),
180 before = i < 0 ? value : value.substring(0, i), 180 before = i < 0 ? value : value.substring(0, i),
181 after = i < 0 ? '' : localeDecimal + value.substring(i + 1); 181 after = i < 0 ? '' : localeDecimal + value.substring(i + 1);
182 182
183 // If the fill character is not '0', grouping is applied before 183 // If the fill character is not '0', grouping is applied before
184 //padding. 184 //padding.
185 if (zfill == null && comma) { 185 if (zfill == null && comma) {
186 before = formatGroup(before); 186 before = formatGroup(before);
187 } 187 }
188 188
189 var length = prefix.length + 189 int length = prefix.length +
190 before.length + 190 before.length +
191 after.length + 191 after.length +
192 (zcomma ? 0 : negative.length), 192 (zcomma ? 0 : negative.length);
193 padding = length < width 193 var padding = length < width
194 ? new List.filled((length = width - length + 1), '').join(fill) 194 ? new List.filled((length = width - length + 1), '').join(fill)
195 : ''; 195 : '';
196 196
197 // If the fill character is '0', grouping is applied after padding. 197 // If the fill character is '0', grouping is applied after padding.
198 if (zcomma) { 198 if (zcomma) {
199 before = formatGroup(padding + before); 199 before = formatGroup(padding + before);
200 } 200 }
201 201
202 // Apply prefix. 202 // Apply prefix.
203 negative += prefix; 203 negative += prefix;
204 204
205 // Rejoin integer and decimal parts. 205 // Rejoin integer and decimal parts.
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
239 case 'e': 239 case 'e':
240 return (num x, [int p = 0]) => x.toStringAsExponential(p); 240 return (num x, [int p = 0]) => x.toStringAsExponential(p);
241 case 'f': 241 case 'f':
242 return (num x, [int p = 0]) => x.toStringAsFixed(p); 242 return (num x, [int p = 0]) => x.toStringAsFixed(p);
243 case 'r': 243 case 'r':
244 default: 244 default:
245 return (num x, [int p = 0]) => x.toString(); 245 return (num x, [int p = 0]) => x.toString();
246 } 246 }
247 } 247 }
248 } 248 }
OLDNEW
« no previous file with comments | « packages/charted/lib/layout/src/treemap_layout.dart ('k') | packages/charted/lib/locale/format/time_format.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698