File tree Expand file tree Collapse file tree 1 file changed +18
-8
lines changed Expand file tree Collapse file tree 1 file changed +18
-8
lines changed Original file line number Diff line number Diff line change @@ -70,14 +70,24 @@ class _MeasurementChartWidgetFlState extends State<MeasurementChartWidgetFl> {
70
70
71
71
LineTouchData tooltipData () {
72
72
return LineTouchData (
73
- touchTooltipData: LineTouchTooltipData (getTooltipItems: (touchedSpots) {
74
- return touchedSpots.map ((touchedSpot) {
75
- return LineTooltipItem (
76
- '${touchedSpot .y .toStringAsFixed (1 )} ${widget ._unit }' ,
77
- TextStyle (color: touchedSpot.bar.color, fontWeight: FontWeight .bold),
78
- );
79
- }).toList ();
80
- }),
73
+ touchTooltipData: LineTouchTooltipData (
74
+ getTooltipColor: (touchedSpot) => Theme .of (context).colorScheme.primaryContainer,
75
+ getTooltipItems: (touchedSpots) {
76
+ return touchedSpots.map ((touchedSpot) {
77
+ final DateTime date = DateTime .fromMillisecondsSinceEpoch (touchedSpot.x.toInt ());
78
+ final dateStr =
79
+ DateFormat .Md (Localizations .localeOf (context).languageCode).format (date);
80
+
81
+ return LineTooltipItem (
82
+ '$dateStr : ${touchedSpot .y .toStringAsFixed (1 )} ${widget ._unit }' ,
83
+ TextStyle (
84
+ color: touchedSpot.bar.color,
85
+ fontWeight: FontWeight .bold,
86
+ ),
87
+ );
88
+ }).toList ();
89
+ },
90
+ ),
81
91
);
82
92
}
83
93
You can’t perform that action at this time.
0 commit comments