kandy
 
0.8.0-RC1
Because kandy 0.8.0-RC1 is still in development, this documentation may not be entirely accurate and is subject to change.

Bar Gradient

Edit pageLast modified: 05 August 2024
val cities by columnOf("London", "Paris", "Berlin", "Madrid", "Rome", "Amsterdam", "Prague")
val airPollution by columnOf(70, 65, 50, 60, 55, 45, 53)
val numberOfCars by columnOf(3000, 2800, 1800, 2500, 2100, 1300, 2000)

val dataset = dataFrameOf(cities, airPollution, numberOfCars)

dataset.plot {
    layout.title = "Air Pollution and Vehicle Count Analysis"
    bars {
        x(cities) { axis.name = "City" }
        y(numberOfCars) { axis.name = "Number of cars (thousands)" }
        fillColor(airPollution) {
            legend.name = "Air Pollution\n Level (AQI)"
            scale = continuous(Color.GREEN..Color.RED)
        }
        alpha = 0.8
    }
}
Bar Gradient