commonMain.jetbrains.datalore.plot.base.scale.Scales.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.base.scale
import jetbrains.datalore.plot.base.Aes
import jetbrains.datalore.plot.base.Scale
object Scales {
fun continuousDomain(
name: String,
aes: Aes
): Scale {
return ContinuousScale(
name,
Mappers.undefined(),
aes.isNumeric
)
}
fun continuousDomainNumericRange(
name: String
): Scale {
return ContinuousScale(
name,
Mappers.undefined(),
true
)
}
fun continuousDomain(
name: String,
mapper: (Double?) -> T?,
continuousRange: Boolean
): Scale {
return ContinuousScale(name, mapper, continuousRange)
}
fun discreteDomain(name: String, domainValues: Collection): Scale {
return discreteDomain(
name,
domainValues,
Mappers.undefined()
)
}
fun discreteDomain(name: String, domainValues: Collection, mapper: ((Double?) -> T?)): Scale {
return DiscreteScale(name, domainValues, mapper)
}
fun pureDiscrete(
name: String,
domainValues: List,
outputValues: List,
defaultOutputValue: T
): Scale {
return discreteDomain(name, domainValues)
.with()
.mapper(Mappers.discrete(outputValues, defaultOutputValue))
.build()
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy