just using `aChart.configuration = ....` with new ...
# kvision
r
just using
aChart.configuration = ....
with new
Configuration
object containing new data should work so I would try to: 1. create a helper function to get current configuration:
Copy code
fun getChartConfig() = Configuration(
        ChartType.PIE,
        listOf(
            DataSets(
                data = pieSizes
            )
        )
    )
2. create a chart with the help of this function:
Copy code
val aChart = Chart(getChartConfig())
3. subscribe to the observable list:
Copy code
pieSizes.onUpdate += {
   aChart.configuration = getChartConfig()
}
l
The pieSizes.onUpdate is neat and works as expected. Got the problem with the Configuration, though, If I add it as you suggest I get an exception at each update. It seems the labels argument is mandatory, even though it is specified as "val labels: List<String>?" in the documentation. If I add an "listOf(") the chart update works as I want.
But, I do not want the labels beside the chart. Take too much space, and I have my own label implementation through a tabulator table. 🤔
Now I got it to work the way I want. To summarise. I took your example, added a listOf() labels, and finally applied the options = ChartOptions(responsive = false, legend = LegendOptions(display = false)) to get rid of the labels beside the charts. Thanks a lot!🙂