From ec806f3e63903664e8be5c9d7ecc3865c4bae29d Mon Sep 17 00:00:00 2001 From: Aditi Bhatia Date: Thu, 7 Mar 2024 14:04:23 -0800 Subject: [PATCH 1/2] Update coloring of bar --- .../lists/sections/traffic/TrafficBarChartViewHolder.kt | 9 +++++++++ 1 file changed, 9 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 764f854b6190..46ddf7ea7bb2 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 @@ -178,6 +178,15 @@ class TrafficBarChartViewHolder(parent: ViewGroup) : BlockListItemViewHolder( private fun buildDataSet(context: Context, cut: List): BarDataSet { val dataSet = BarDataSet(cut, "Data") dataSet.color = ContextCompat.getColor(context, R.color.blue_50) + dataSet.setGradientColor( + ContextCompat.getColor( + context, + R.color.blue_50 + ), ContextCompat.getColor( + context, + R.color.blue_50 + ) + ) dataSet.formLineWidth = 0f dataSet.setDrawValues(false) From 02daa2bc2994a3d84973c6cc1975abefa35353aa Mon Sep 17 00:00:00 2001 From: Aditi Bhatia Date: Fri, 8 Mar 2024 18:38:04 -0800 Subject: [PATCH 2/2] Update workaround for library bug --- .../traffic/TrafficBarChartViewHolder.kt | 10 +------ .../viewholders/BarChartViewHolder.kt | 30 ++----------------- 2 files changed, 4 insertions(+), 36 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 46ddf7ea7bb2..e0bcad563e19 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 @@ -177,16 +177,8 @@ class TrafficBarChartViewHolder(parent: ViewGroup) : BlockListItemViewHolder( private fun buildDataSet(context: Context, cut: List): BarDataSet { val dataSet = BarDataSet(cut, "Data") + chart.renderer.paintRender.shader = null dataSet.color = ContextCompat.getColor(context, R.color.blue_50) - dataSet.setGradientColor( - ContextCompat.getColor( - context, - R.color.blue_50 - ), ContextCompat.getColor( - context, - R.color.blue_50 - ) - ) dataSet.formLineWidth = 0f dataSet.setDrawValues(false) diff --git a/WordPress/src/main/java/org/wordpress/android/ui/stats/refresh/lists/sections/viewholders/BarChartViewHolder.kt b/WordPress/src/main/java/org/wordpress/android/ui/stats/refresh/lists/sections/viewholders/BarChartViewHolder.kt index 33e93e01465f..e459f53c6883 100644 --- a/WordPress/src/main/java/org/wordpress/android/ui/stats/refresh/lists/sections/viewholders/BarChartViewHolder.kt +++ b/WordPress/src/main/java/org/wordpress/android/ui/stats/refresh/lists/sections/viewholders/BarChartViewHolder.kt @@ -229,16 +229,8 @@ class BarChartViewHolder(parent: ViewGroup) : BlockListItemViewHolder( private fun buildDataSet(context: Context, cut: List): BarDataSet { val dataSet = BarDataSet(cut, "Data") + chart.renderer.paintRender.shader = null dataSet.color = ContextCompat.getColor(context, R.color.stats_bar_chart_top) - dataSet.setGradientColor( - ContextCompat.getColor( - context, - R.color.stats_bar_chart_top - ), ContextCompat.getColor( - context, - R.color.stats_bar_chart_top - ) - ) dataSet.formLineWidth = 0f dataSet.setDrawValues(false) dataSet.isHighlightEnabled = true @@ -252,16 +244,8 @@ class BarChartViewHolder(parent: ViewGroup) : BlockListItemViewHolder( private fun buildOverlappingDataSet(context: Context, cut: List): BarDataSet { val dataSet = BarDataSet(cut, "Overlapping data") + chart.renderer.paintRender.shader = null dataSet.color = ContextCompat.getColor(context, R.color.primary_60) - dataSet.setGradientColor( - ContextCompat.getColor( - context, - R.color.stats_bar_chart_bottom - ), ContextCompat.getColor( - context, - R.color.stats_bar_chart_bottom - ) - ) dataSet.formLineWidth = 0f dataSet.setDrawValues(false) dataSet.isHighlightEnabled = true @@ -279,16 +263,8 @@ class BarChartViewHolder(parent: ViewGroup) : BlockListItemViewHolder( BarEntry(it.x, maxEntry.y, it.data) } val dataSet = BarDataSet(highlightedDataSet, "Highlight") + chart.renderer.paintRender.shader = null dataSet.color = ContextCompat.getColor(context, AndroidR.color.transparent) - dataSet.setGradientColor( - ContextCompat.getColor( - context, - AndroidR.color.transparent - ), ContextCompat.getColor( - context, - AndroidR.color.transparent - ) - ) dataSet.formLineWidth = 0f dataSet.isHighlightEnabled = true dataSet.highLightColor = ContextCompat.getColor(