Browser zoom and selection issue
import io.data2viz.charts.*
import io.data2viz.charts.core.Padding
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.charts.config.configs.*
import io.data2viz.charts.config.*
import io.data2viz.charts.core.CursorType
import io.data2viz.math.*
import io.data2viz.color.*
import io.data2viz.geom.*
import io.data2viz.shape.Symbols
import io.data2viz.dsv.Dsv
import org.w3c.fetch.Response
import kotlinx.browser.window
import kotlin.js.Promise
import kotlinx.datetime.Instant
val width = 400.0
val height = 400.0
data class Record(
val index: Int,
val value: Double,
)
val records = listOf(
Record(0, .0),
Record(1, 10.0),
Record(2, 20.0),
Record(7, 70.0),
Record(8, 80.0),
Record(9, 90.0),
Record(10, 100.0),
)
fun main() {
// Creating and sizing the VizContainer
val vc = newVizContainer().apply { size = Size(width, height) }
vc.chart(records) {
config {
tooltip {
show = false
}
events {
zoomMode = ZoomMode.X
selectionMode = SelectionMode.Single
triggerMode = TriggerMode.Column
}
}
val indexDimension = quantitative({domain.index.toDouble()})
val valueDimension = quantitative({domain.value})
plot(indexDimension, valueDimension)
}
}
comments