Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rounded Horizontal Bar Chart not rendering colors for split bar entries #259

Open
KevinAlvarez-JaJa opened this issue Jul 18, 2024 · 3 comments

Comments

@KevinAlvarez-JaJa
Copy link

KevinAlvarez-JaJa commented Jul 18, 2024

Im trying to program a spending limit with rounded corners and my current chart is this:
image

I use a horizontal bar chart which is split into spent and remaining, assigned values here:

val barChart = HorizontalBarChart(LocalContext.current)
val entries = listOf(
    BarEntry(0f, floatArrayOf(spent, remaining))
)
val dataSet = BarDataSet(entries, "").apply {
    colors = listOf(spentColor, Color.rgb(64, 64, 64)) // Spent color and remaining color
    valueTextColor = Color.WHITE
    valueTextSize = 16f
    setDrawValues(false) // Hide the value labels on the bars
}

However, when setting the renderer like here:

renderer = RoundedHorizontalBarChartRenderer(this, ChartAnimator(), ViewPortHandler())
(renderer as RoundedHorizontalBarChartRenderer).setRoundedPositiveDataSetRadius(20f) // Set the corner radius 

as needed

image

The bar chart is loaded in as I can highlight it however there is no color at all, it is the same color as the background (commenting out setting the custom renderer fixes this)

I think the RoundedHorizontalBarChartRenderer doesn't work with split bar charts. If this is not the case if someone can let me know what I am doing wrong, if it is the case then I would be happy to give a go fixing it.

@hannesa2
Copy link
Collaborator

The change comes from here PhilJay#5420 and I recommend to start to debug

@KevinAlvarez-JaJa
Copy link
Author

KevinAlvarez-JaJa commented Jul 23, 2024

The change comes from here PhilJay#5420 and I recommend to start to debug

I have been debugging and I just wanted to ask if there are any example uses of either of the rounded bar chart renderers (apart from the pie chart renderer), as I have not found any working use cases? It would help a lot if I knew the intended way to use the custom renderer of the bar charts.

@hannesa2
Copy link
Collaborator

I made at least a sample 3bc194d#diff-d5e9f4a0673a80af653d3221b0e4e8830ec3dfabdf090f6deca92eb75b74a9c0

containing screenshot tests as well
814de5e

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants