import io.data2viz.charts.*
import io.data2viz.charts.dimension.*
import io.data2viz.charts.chart.*
import io.data2viz.charts.chart.mark.*
import io.data2viz.charts.viz.*
import io.data2viz.charts.layout.*
import io.data2viz.geom.*
val width = 600.0
val height = 500.0
data class PopCount(val question: Int, val gradeScored: Double)
fun main() {
// Creating and sizing the VizContainer
val vc = newVizContainer().apply {
size = Size(width, height)
}
vc.chart(canPop) {
title = "Grade Progress"
// Create a discrete dimension for the year of the census
val Question = discrete( { domain.question } )
// Create a continuous numeric dimension for the population
val GradeScored = quantitative( { domain.gradeScored } ) {
name = "Grade Scored"
}
// Using a discrete dimension for the Y-axis and a continuous one for the X-axis
bar(Question, GradeScored)
}
}
val canPop = listOf(
PopCount(1,0.0),
PopCount(2,0.0),
PopCount(3,1.0),
PopCount(4,1.0),
PopCount(5,1.0),
PopCount(6,1.0),
PopCount(7,1.0),
PopCount(8,0.0),
PopCount(9,0.0),
PopCount(10,1.0),
PopCount(11,1.0),
PopCount(12,1.0),
PopCount(13,0.0),
PopCount(14,1.0)
)
comments