diff options
author | Robert Jaros <rjaros@finn.pl> | 2019-10-17 21:58:34 +0200 |
---|---|---|
committer | Robert Jaros <rjaros@finn.pl> | 2019-10-17 21:58:34 +0200 |
commit | 736b80835f67c9c34657074ebcfbe0752bef1c18 (patch) | |
tree | 82d1e18a9ec07692dfe5dd31f470b842a9950a89 /kvision-modules/kvision-chart/src | |
parent | 53b325d52208bfd44ba6a524ce3dda5379aed699 (diff) | |
download | kvision-736b80835f67c9c34657074ebcfbe0752bef1c18.tar.gz kvision-736b80835f67c9c34657074ebcfbe0752bef1c18.tar.bz2 kvision-736b80835f67c9c34657074ebcfbe0752bef1c18.zip |
Move DSL builder functions out of the companion objects (#93)
Diffstat (limited to 'kvision-modules/kvision-chart/src')
-rw-r--r-- | kvision-modules/kvision-chart/src/main/kotlin/pl/treksoft/kvision/chart/Chart.kt | 33 |
1 files changed, 17 insertions, 16 deletions
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 91658476..29cc80c2 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 @@ -110,22 +110,6 @@ open class Chart( } companion object { - /** - * DSL builder extension function. - * - * It takes the same parameters as the constructor of the built component. - */ - fun Container.chart( - configuration: Configuration, - chartWidth: Int? = null, - chartHeight: Int? = null, - classes: Set<String> = setOf(), - init: (Chart.() -> Unit)? = null - ): Chart { - val chart = Chart(configuration, chartWidth, chartHeight, classes).apply { init?.invoke(this) } - this.add(chart) - return chart - } fun registerPlugin(plugin: dynamic) { JsChart.plugins.register(plugin) @@ -136,3 +120,20 @@ open class Chart( } } } + +/** + * DSL builder extension function. + * + * It takes the same parameters as the constructor of the built component. + */ +fun Container.chart( + configuration: Configuration, + chartWidth: Int? = null, + chartHeight: Int? = null, + classes: Set<String> = setOf(), + init: (Chart.() -> Unit)? = null +): Chart { + val chart = Chart(configuration, chartWidth, chartHeight, classes).apply { init?.invoke(this) } + this.add(chart) + return chart +} |