2022-09-15 15:40:02 +00:00
|
|
|
import 'package:selfprivacy/logic/common_enum/common_enum.dart';
|
2022-11-12 17:29:06 +00:00
|
|
|
import 'package:selfprivacy/logic/models/metrics.dart';
|
2022-09-15 15:40:02 +00:00
|
|
|
import 'package:intl/intl.dart';
|
|
|
|
|
|
|
|
String bottomTitle(
|
|
|
|
final int value,
|
|
|
|
final List<TimeSeriesData> data,
|
|
|
|
final Period period,
|
|
|
|
) {
|
|
|
|
final hhmm = DateFormat('HH:mm');
|
|
|
|
final day = DateFormat('MMMd');
|
|
|
|
String res;
|
|
|
|
|
2022-11-14 16:45:05 +00:00
|
|
|
if (value <= 0 || value >= data.length) {
|
2022-09-15 15:40:02 +00:00
|
|
|
return '';
|
|
|
|
}
|
|
|
|
|
|
|
|
final time = data[value].time;
|
|
|
|
switch (period) {
|
|
|
|
case Period.hour:
|
|
|
|
case Period.day:
|
|
|
|
res = hhmm.format(time);
|
|
|
|
break;
|
|
|
|
case Period.month:
|
|
|
|
res = day.format(time);
|
|
|
|
}
|
|
|
|
|
|
|
|
return res;
|
|
|
|
}
|