import io.data2viz.charting.*
import io.data2viz.charting.dimension.*
import io.data2viz.charting.chart.*
import io.data2viz.charting.chart.mark.*
import io.data2viz.charting.viz.*
import io.data2viz.charting.layout.*
import io.data2viz.charting.core.*
import io.data2viz.geom.*
import io.data2viz.color.*
import io.data2viz.math.*
import kotlin.random.Random
val width = 700.0
val height = 400.0
val randomPoints = (1 .. 1000).map{ Point(Random.nextDouble(), Random.nextDouble()) }
fun main() {
// Creating and sizing the VizContainer
val vc = newVizContainer().apply {
size = Size(width, height)
}
// Chart DSL, our domain object is a "Point"
vc.chart(randomPoints) {
// Disable highlight and selection from the chart
highlightMode = HighlightMode.None
selectionMode = SelectionMode.None
// Create 2 continuous numeric dimensions
val xPosition = quantitative( { domain.x } )
val yPosition = quantitative( { domain.y } )
// Plot values
plot(xPosition, yPosition) {
size = discrete( { (domain.x + domain.y) * 80.0 })
strokeColor = discrete( {
val angle = ((domain.x + domain.y) * PI).rad
Colors.hsl(angle, 80.pct, 50.pct)
} )
}
}
}