commonMain.jetbrains.datalore.plot.builder.assemble.LegendAssemblerUtil.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 jetbrains.datalore.plot.base.Aes
import jetbrains.datalore.plot.base.Aesthetics
import jetbrains.datalore.plot.base.aes.AestheticsBuilder
import jetbrains.datalore.plot.base.aes.AestheticsDefaults
import jetbrains.datalore.plot.builder.guide.LegendDirection
import jetbrains.datalore.plot.builder.guide.LegendPosition
import jetbrains.datalore.plot.builder.theme.LegendTheme
internal object LegendAssemblerUtil {
fun mapToAesthetics(
valuesByAes: Map, List>, constantByAes: Map, T>, aestheticsDefaults: AestheticsDefaults
): Aesthetics {
val builder = AestheticsBuilder(0)
for (aes in Aes.values()) {
@Suppress("UNCHECKED_CAST")
builder.constantAes(aes as Aes, aestheticsDefaults.defaultValue(aes))
}
for (aes in valuesByAes.keys) {
val values = valuesByAes.getValue(aes)
builder.aes(aes, AestheticsBuilder.list(values))
builder.dataPointCount(values.size)
}
for (aes in constantByAes.keys) {
builder.constantAes(aes, constantByAes[aes]!!)
}
return builder.build()
}
fun mapToAesthetics(
valueByAesIterable: Collection
© 2015 - 2025 Weber Informatics LLC | Privacy Policy