Skip to content

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

@KevinAlvarez-JaJa

Description

@KevinAlvarez-JaJa

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions