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.DiscreteTransform
import jetbrains.datalore.plot.base.Scale
object Scales {
fun continuousDomain(
name: String,
continuousRange: Boolean
): Scale {
return ContinuousScale(name, continuousRange)
}
fun discreteDomain(
name: String,
discreteTransform: DiscreteTransform,
): Scale {
return DiscreteScale(name, discreteTransform)
}
/**
* Functions to be used in demos and tests only.
*/
object DemoAndTest {
fun discreteDomain(
name: String,
domainValues: List,
domainLimits: List = emptyList(),
): Scale {
return DiscreteScale(
name,
DiscreteTransform(domainValues, domainLimits),
)
}
fun pureDiscrete(
name: String,
domainValues: List,
): Scale {
val transform = DiscreteTransform(domainValues, emptyList())
return DiscreteScale(name, transform)
}
fun continuousDomain(name: String, aes: Aes): Scale {
return ContinuousScale(
name,
aes.isNumeric
)
}
fun continuousDomainNumericRange(name: String): Scale {
return ContinuousScale(
name,
true
)
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy