commonMain.jetbrains.datalore.plot.builder.assemble.LegendOptions.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of lets-plot-common Show documentation
Show all versions of lets-plot-common Show documentation
Lets-Plot JVM package without rendering part
/*
* Copyright (c) 2019. JetBrains s.r.o.
* Use of this source code is governed by the MIT license that can be found in the LICENSE file.
*/
package jetbrains.datalore.plot.builder.assemble
import kotlin.math.max
class LegendOptions : GuideOptions() {
private var myColCount: Int? = null
private var myRowCount: Int? = null
var isByRow: Boolean = false
var colCount: Int
get() = myColCount!!
set(colCount) {
myColCount = max(1, colCount)
}
var rowCount: Int
get() = myRowCount!!
set(rowCount) {
myRowCount = max(1, rowCount)
}
fun hasColCount(): Boolean {
return myColCount != null
}
fun hasRowCount(): Boolean {
return myRowCount != null
}
companion object {
fun combine(optionsList: List): LegendOptions {
val result = LegendOptions()
for (options in optionsList) {
if (options.isByRow) {
result.isByRow = true
}
if (options.hasColCount()) {
result.colCount = options.colCount
}
if (options.hasRowCount()) {
result.rowCount = options.rowCount
}
}
return result
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy