All Downloads are FREE. Search and download functionalities are using the official Maven repository.

commonMain.jetbrains.datalore.plot.base.scale.Scales.kt Maven / Gradle / Ivy

There is a newer version: 4.5.3-alpha1
Show newest version
/*
 * 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