<@UM5G69R8W> 1. you are applying height to the out...
# kvision
r
@Lars Erik Rojeras 1. you are applying height to the outer container instead of the chart component itself (
add
returns the container) 2. chart.js has built in control for the aspect ratio of the chart, which is 2:1 - you need to disable it with
maintainAspectRation = false
if you want fully responsive chart this is working for me (maintains 25% of window size in both directions):
Copy code
chart(
                Configuration(
                    ChartType.SCATTER,
                    listOf(
                        DataSets(
                            pointBorderColor = listOf(Color.name(Col.RED)),
                            backgroundColor = listOf(Color.name(Col.LIGHTGREEN)),
                            data = (-60..60).map {
                                obj {
                                    x = it.toDouble() / 10
                                    y = sin(it.toDouble() / 10)
                                }
                            }
                        )
                    ),
                    options = ChartOptions(
                        maintainAspectRatio = false,
                        legend = LegendOptions(display = false),
                        showLines = true
                    )
                )
            ).apply {
                width = 25.vw
                height = 25.vh
            }