Skip to content

Commit

Permalink
fix: incorrect overview graph timestamp
Browse files Browse the repository at this point in the history
  • Loading branch information
tien committed Oct 22, 2023
1 parent cc34d11 commit 0c26d75
Showing 1 changed file with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ import kotlinx.coroutines.delay
import kotlinx.coroutines.launch
import java.text.DateFormat
import java.text.DateFormat.getTimeInstance
import java.util.Date

@Composable
fun HomeScreen(viewModel: HomeViewModel = hiltViewModel()) {
Expand Down Expand Up @@ -210,7 +211,7 @@ fun HomeScreen(viewModel: HomeViewModel = hiltViewModel()) {
val queriesOverTimeData = remember(viewModel.queriesOverTime) {
LineChartData(
label = queriesOverTimeLabel,
data = viewModel.queriesOverTime.map { Pair(it.key * 1000, it.value) },
data = viewModel.queriesOverTime.map { Pair(it.key, it.value) },
color = successColor
)
}
Expand All @@ -219,7 +220,7 @@ fun HomeScreen(viewModel: HomeViewModel = hiltViewModel()) {
val adsOverTimeData = remember(viewModel.adsOverTime) {
LineChartData(
label = adsOverTimeLabel,
data = viewModel.adsOverTime.map { Pair(it.key * 1000, it.value) },
data = viewModel.adsOverTime.map { Pair(it.key, it.value) },
color = errorColor
)
}
Expand All @@ -236,7 +237,7 @@ fun HomeScreen(viewModel: HomeViewModel = hiltViewModel()) {
data = listOf(queriesOverTimeData, adsOverTimeData),
xAxisFormatter = remember { getTimeInstance(DateFormat.SHORT) }.let { dateTime ->
{ value ->
dateTime.format(value)
dateTime.format(Date(value.toLong() * 1000))
}
})
}
Expand Down

0 comments on commit 0c26d75

Please sign in to comment.