import io.data2viz.charts.*
import io.data2viz.charts.core.*
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.*
import io.data2viz.color.*
import io.data2viz.random.RandomDistribution
import io.data2viz.timeFormat.*
import io.data2viz.timeFormat.TimeLocale
import kotlinx.datetime.Instant
import io.data2viz.math.*
import io.data2viz.shape.*
import kotlin.random.*
import kotlin.math.*
fun main() {
// Creating and sizing the VizContainer
val vc = newVizContainer().apply {
size = Size(max(width, height), max(width, height))
}
val samples = generateData(5, 20_000)
vc.chart(samples) {
config {
performanceMode = true
events {
triggerMode = TriggerMode.Column
zoomMode = ZoomMode.XY
panMode = PanMode.X
}
cursor {
show = true
}
}
val timeDim = quantitative( { domain.second.toDouble() } )
val tempDim = quantitative( { domain.third } )
series = discrete( {domain.first} )
line(timeDim, tempDim) {
marker = discrete ( { Symbols.Circle } )
showMarkers = true
}
}
}
val width = 450.0
val height = 300.0
fun generateData(series:Int, samplesPerSeries:Int): List<Triple<Int, Double, Double>> {
return listOf(
Triple(0, 12.27071736, -4.24498169),
Triple(0, 0.27085864, 0.04058150),
Triple(0, -0.71883271, -0.10630052),
Triple(0, -0.00000000, 0.00000000),
Triple(0, 0.71875475, 0.10832067),
Triple(0, 1.43747577, 0.21866853),
Triple(0, 3.96550387, -0.76388501),
Triple(0, 8.40324100, -2.48868661),
Triple(0, 16.95236081, -2.97447535),
Triple(1, 12.27071736, -4.24498169),
Triple(1, 0.27085864, 0.04058150),
Triple(1, -0.71883271, -0.10630052),
)
}
comments