Skip to content

Commit

Permalink
Merge pull request #20436 from wordpress-mobile/origin/issue/20413-gr…
Browse files Browse the repository at this point in the history
…adient-bar-bug-fix

Fix bars turning green issue when switching from a graph with empty data
  • Loading branch information
irfano authored Mar 9, 2024
2 parents 5e6a217 + 02daa2b commit 2bf30f7
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 27 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,7 @@ class TrafficBarChartViewHolder(parent: ViewGroup) : BlockListItemViewHolder(

private fun buildDataSet(context: Context, cut: List<BarEntry>): BarDataSet {
val dataSet = BarDataSet(cut, "Data")
chart.renderer.paintRender.shader = null
dataSet.color = ContextCompat.getColor(context, R.color.blue_50)
dataSet.formLineWidth = 0f
dataSet.setDrawValues(false)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -229,16 +229,8 @@ class BarChartViewHolder(parent: ViewGroup) : BlockListItemViewHolder(

private fun buildDataSet(context: Context, cut: List<BarEntry>): 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
Expand All @@ -252,16 +244,8 @@ class BarChartViewHolder(parent: ViewGroup) : BlockListItemViewHolder(

private fun buildOverlappingDataSet(context: Context, cut: List<BarEntry>): 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
Expand All @@ -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(
Expand Down

0 comments on commit 2bf30f7

Please sign in to comment.