【发布时间】:2019-02-21 21:47:59
【问题描述】:
我有一个散点图,里面有一些点。我想在按下按钮时更新点的位置。我有以下代码:
class Point(var x: Int, var y: Int)
class TestView : View("TestView") {
val points = listOf(Point(0,1),Point(1,1)).observable()
override val root = borderpane {
center {
scatterchart("test", NumberAxis(), NumberAxis()) {
series("Group 1") {
points.forEach{
data(it.x, it.y)
}
}
}
}
bottom {
button("Button") {
action {
points[0].x = 5
}
}
}
}
}
当我按下按钮时,什么也没有发生。我做错了什么?
【问题讨论】: