From 8394773791fcfb02ef475077987fb6a5d264bbf4 Mon Sep 17 00:00:00 2001 From: Irfan Omur Date: Thu, 29 Feb 2024 15:19:35 +0300 Subject: [PATCH 1/2] Remove granularity from `TrafficBarChartViewHolder` granularity is necessary for the zoom feature on the chart. Zoom feature is not being used, so granularity is unnecessary. --- .../refresh/lists/sections/traffic/TrafficBarChartViewHolder.kt | 2 -- 1 file changed, 2 deletions(-) diff --git a/WordPress/src/main/java/org/wordpress/android/ui/stats/refresh/lists/sections/traffic/TrafficBarChartViewHolder.kt b/WordPress/src/main/java/org/wordpress/android/ui/stats/refresh/lists/sections/traffic/TrafficBarChartViewHolder.kt index 92e741fce46d..11df4b0219ce 100644 --- a/WordPress/src/main/java/org/wordpress/android/ui/stats/refresh/lists/sections/traffic/TrafficBarChartViewHolder.kt +++ b/WordPress/src/main/java/org/wordpress/android/ui/stats/refresh/lists/sections/traffic/TrafficBarChartViewHolder.kt @@ -139,7 +139,6 @@ class TrafficBarChartViewHolder(parent: ViewGroup) : BlockListItemViewHolder( setDrawTopYLabelEntry(true) setDrawZeroLine(false) setDrawAxisLine(true) - granularity = 1f axisMinimum = 0f axisMaximum = if (maxYValue < minYValue) { minYValue @@ -156,7 +155,6 @@ class TrafficBarChartViewHolder(parent: ViewGroup) : BlockListItemViewHolder( private fun configureXAxis(item: BlockListItem.BarChartItem) { chart.xAxis.apply { - granularity = 1f setDrawAxisLine(false) setDrawGridLines(false) From 10bbe8e30c147283af2c0e711e6c83b26211216d Mon Sep 17 00:00:00 2001 From: Irfan Omur Date: Thu, 29 Feb 2024 15:20:45 +0300 Subject: [PATCH 2/2] Set minimum and maximum values for the left axis of the traffic chart --- .../lists/sections/traffic/TrafficBarChartViewHolder.kt | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/WordPress/src/main/java/org/wordpress/android/ui/stats/refresh/lists/sections/traffic/TrafficBarChartViewHolder.kt b/WordPress/src/main/java/org/wordpress/android/ui/stats/refresh/lists/sections/traffic/TrafficBarChartViewHolder.kt index 11df4b0219ce..a26a79885223 100644 --- a/WordPress/src/main/java/org/wordpress/android/ui/stats/refresh/lists/sections/traffic/TrafficBarChartViewHolder.kt +++ b/WordPress/src/main/java/org/wordpress/android/ui/stats/refresh/lists/sections/traffic/TrafficBarChartViewHolder.kt @@ -131,6 +131,12 @@ class TrafficBarChartViewHolder(parent: ViewGroup) : BlockListItemViewHolder( setDrawZeroLine(false) setDrawLabels(false) setDrawAxisLine(false) + axisMinimum = 0f + axisMaximum = if (maxYValue < minYValue) { + minYValue + } else { + roundUp(maxYValue.toFloat()) + } } chart.axisRight.apply {