Charts
KVision Chart component is based on awesome Chart.js library. It allows you to create many different types of charts with a lot of options and additional functionalities. This component is contained in kvision-chart module. KVision adds Kotlin type-safe bindings for most of Chart.js API but you should get familiar with Chart.js documentation to achieve best results.
To create a chart use pl.treksoft.kvision.chart.Chart
class. Its constructor takes one required parameter of pl.treksoft.kvision.chart.Configuration
class. The configuration object specifies both the data and the options for the chart.
By default the chart component is responsive - its size is calculated based on the size of the outer container. You can set responsive
option to false
and use additional constructor parameters, chartWidth
and chartHeight
, to create the chart with a fixed size.
When specifying colors (for lines, points, backgrounds, legend, title, hovers etc.) use KVision's Color
class.
Internationalization of chart textual data is also fully supported (including dynamic language change).
You can find more examples of charts usage in the Showcase app in the kvision-examples repository on GitHub.
Last updated