mirror of
https://git.selfprivacy.org/kherel/selfprivacy.org.app.git
synced 2024-11-13 20:23:16 +00:00
30 lines
603 B
Dart
30 lines
603 B
Dart
|
import 'package:selfprivacy/logic/common_enum/common_enum.dart';
|
||
|
import 'package:selfprivacy/logic/models/hetzner_metrics.dart';
|
||
|
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;
|
||
|
|
||
|
if (value <= 0) {
|
||
|
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;
|
||
|
}
|