Robert Jaros
08/19/2020, 11:45 AMadd
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):
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
}