commonMain.jetbrains.datalore.plot.base.Scale.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
import jetbrains.datalore.plot.base.scale.BreaksGenerator
import jetbrains.datalore.plot.base.scale.ScaleBreaks
/**
* Translates input to aesthetics by
* 1) Transforming data (like x1=log(x)). Must happen before 'stat' is applies to data
* 2) Mapping data to aesthetic
*
*
* name - (axis/legend title)
* breaks (domain values) - ticks on axis, items/segments on legends
* labels - tick labels
*
* @param - type of target aesthetic
*
*/
interface Scale { // ToDo: remove : it only make sense for mapper.
val name: String
val labelFormatter: ((Any) -> String)?
/**
* @return TRUE if both, domain and range are continuous
*/
val isContinuous: Boolean
val isContinuousDomain: Boolean
val multiplicativeExpand: Double
val additiveExpand: Double
val transform: Transform
fun hasBreaks(): Boolean
fun getBreaksGenerator(): BreaksGenerator
fun getScaleBreaks(): ScaleBreaks
fun with(): Builder
interface Builder {
fun name(v: String): Builder
fun breaks(l: List): Builder
fun labels(l: List): Builder
fun labelFormatter(v: (Any) -> String): Builder
fun multiplicativeExpand(v: Double): Builder
fun additiveExpand(v: Double): Builder
fun continuousTransform(v: ContinuousTransform): Builder
fun breaksGenerator(v: BreaksGenerator): Builder
fun build(): Scale
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy