From 134cb687c4e05fd81a03b682505f9fb9d741a8d7 Mon Sep 17 00:00:00 2001 From: Robert Jaros Date: Sat, 9 May 2020 23:53:57 +0200 Subject: Add new className parameter to all DSL builder functions. --- .../src/main/kotlin/pl/treksoft/kvision/chart/Chart.kt | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'kvision-modules/kvision-chart') diff --git a/kvision-modules/kvision-chart/src/main/kotlin/pl/treksoft/kvision/chart/Chart.kt b/kvision-modules/kvision-chart/src/main/kotlin/pl/treksoft/kvision/chart/Chart.kt index 55718918..30ce529b 100644 --- a/kvision-modules/kvision-chart/src/main/kotlin/pl/treksoft/kvision/chart/Chart.kt +++ b/kvision-modules/kvision-chart/src/main/kotlin/pl/treksoft/kvision/chart/Chart.kt @@ -24,9 +24,10 @@ package pl.treksoft.kvision.chart import com.github.snabbdom.VNode import pl.treksoft.kvision.chart.js.Chart.ChartConfiguration import pl.treksoft.kvision.chart.js.PluginServiceGlobalRegistration -import pl.treksoft.kvision.chart.js.Chart as JsChart import pl.treksoft.kvision.core.Container import pl.treksoft.kvision.core.Widget +import pl.treksoft.kvision.utils.set +import pl.treksoft.kvision.chart.js.Chart as JsChart /** * Chart component. @@ -133,10 +134,11 @@ fun Container.chart( configuration: Configuration, chartWidth: Int? = null, chartHeight: Int? = null, - classes: Set = setOf(), + classes: Set? = null, + className: String? = null, init: (Chart.() -> Unit)? = null ): Chart { - val chart = Chart(configuration, chartWidth, chartHeight, classes).apply { init?.invoke(this) } + val chart = Chart(configuration, chartWidth, chartHeight, classes ?: className.set).apply { init?.invoke(this) } this.add(chart) return chart } -- cgit