We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent f5c0c17 commit 47c89ddCopy full SHA for 47c89dd
app/src/main/kotlin/info/appdev/chartexample/formatter/UnixTimeRelative2NowAxisValueFormatter.kt
@@ -0,0 +1,17 @@
1
+package info.appdev.chartexample.formatter
2
+
3
+import info.appdev.charting.components.AxisBase
4
+import info.appdev.charting.formatter.IAxisValueFormatter
5
+import java.text.SimpleDateFormat
6
+import java.util.Locale
7
8
+class UnixTimeRelative2NowAxisValueFormatter(val format: String = "yyyy-MM-dd'T'HH:mm:ss'Z'") : IAxisValueFormatter {
9
10
+ val simpleDateFormat = SimpleDateFormat(format, Locale.getDefault())
11
12
+ override fun getFormattedValue(value: Float, axis: AxisBase?): String {
13
+ val relative2Now = System.currentTimeMillis() + (value.toLong() * 1000)
14
+ return simpleDateFormat.format(relative2Now)
15
+ }
16
17
+}
0 commit comments