Skip to content

Commit 50c0bf6

Browse files
committed
Format download count number in weekly sparkline tooltip
1 parent ba5f72e commit 50c0bf6

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

pkg/web_app/lib/src/widget/weekly_sparkline/widget.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import 'dart:math';
22

33
import 'package:_pub_shared/format/encoding.dart';
4+
import 'package:intl/intl.dart';
45
import 'package:web/web.dart';
56

67
void create(HTMLElement element, Map<String, String> options) {
@@ -145,8 +146,7 @@ void drawChart(Element svg, HTMLDivElement toolTip, HTMLDivElement chartSubText,
145146
final coords = computeCoordinates(selectedDay.date, selectedDay.downloads);
146147
sparklineSpot.setAttribute('cy', '${coords.$2}');
147148
sparklineCursor.setAttribute('transform', 'translate(${coords.$1}, 0)');
148-
149-
toolTip.text = '${selectedDay.downloads}';
149+
toolTip.text = '${NumberFormat('#,###').format(selectedDay.downloads)}';
150150

151151
final startDate = selectedDay.date.subtract(Duration(days: 7));
152152
chartSubText.text =

pkg/web_app/pubspec.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ dependencies:
1010
api_builder:
1111
collection: ^1.18.0
1212
http: ^1.0.0
13+
intl: ^0.19.0
1314
markdown: ^7.2.0
1415
mdc_web: ^0.6.0
1516
meta: ^1.3.0

0 commit comments

Comments
 (0)