kandy 0.7.0 Help

Several Areas

val dataset = dataFrameOf( "year" to listOf("2016", "2017", "2018", "2019", "2020", "2021"), "Apple" to listOf(700, 800, 750, 900, 850, 950), "Google" to listOf(1000, 950, 1200, 1150, 1250, 1300), "Microsoft" to listOf(600, 700, 650, 700, 750, 800), "Meta" to listOf(1100, 1200, 1150, 1300, 1250, 1350), "Amazon" to listOf(300, 400, 350, 450, 500, 600) ).gather("Apple", "Google", "Microsoft", "Meta", "Amazon").into("company", "users") dataset.groupBy("company").plot { layout.title = "User Growth Dynamics" area { x("year") y("users") fillColor("company") { scale = categorical( "Apple" to Color.hex("#FF45ED"), "Google" to Color.hex("#3DEA62"), "Microsoft" to Color.BLACK, "Meta" to Color.hex("#FDB60D"), "Amazon" to Color.hex("#087CFA") ) } borderLine.color("company") alpha = 0.3 } }
val year = listOf("2016", "2017", "2018", "2019", "2020", "2021") val usersApple = listOf(700, 800, 750, 900, 850, 950) val usersGoogle = listOf(1000, 950, 1200, 1150, 1250, 1300) val usersMicrosoft = listOf(600, 700, 650, 700, 750, 800) val usersMeta = listOf(1100, 1200, 1150, 1300, 1250, 1350) val usersAmazon = listOf(300, 400, 350, 450, 500, 600) val dataset = mapOf( "year" to year + year + year + year + year, "users" to usersApple + usersGoogle + usersMicrosoft + usersMeta + usersAmazon, "company" to List(6) { "Apple" } + List(6) { "Google" } + List(6) { "Microsoft" } + List(6) { "Meta" } + List( 6 ) { "Amazon" } ) plot(dataset) { layout.title = "User Growth Dynamics" groupBy("company") { area { x("year") y("users") fillColor("company") { scale = categorical( "Apple" to Color.hex("#FF45ED"), "Google" to Color.hex("#3DEA62"), "Microsoft" to Color.BLACK, "Meta" to Color.hex("#FDB60D"), "Amazon" to Color.hex("#087CFA") ) } borderLine.color("company") alpha = 0.3 } } }
Several Areas
Last modified: 06 December 2023