elect
09/14/2018, 8:30 PMRuckus
09/14/2018, 8:32 PMelect
09/14/2018, 8:32 PMelect
09/14/2018, 8:33 PMelect
09/14/2018, 8:33 PMRuckus
09/14/2018, 8:34 PMelect
09/14/2018, 8:34 PMelect
09/14/2018, 8:34 PMRuckus
09/14/2018, 8:36 PMelect
09/14/2018, 8:37 PMRuckus
09/14/2018, 8:37 PMRuckus
09/14/2018, 8:38 PMRuckus
09/14/2018, 8:40 PMNode.snapshot(...)
function to generate an image of the graph (everything in JavaFX is a Node
, including graphs)elect
09/14/2018, 8:41 PMelect
09/14/2018, 8:41 PMRuckus
09/14/2018, 8:43 PMelect
09/14/2018, 8:43 PMelect
09/14/2018, 8:43 PMelect
09/14/2018, 8:43 PMsnapshot
on?Ruckus
09/14/2018, 8:45 PMroot
of MyView
(which is a JavaFX ScatterChart
)Ruckus
09/14/2018, 8:46 PMRuckus
09/14/2018, 8:54 PMelect
09/14/2018, 8:54 PMelect
09/14/2018, 8:55 PMsnapshot
looks great in this regardselect
09/14/2018, 8:55 PMRuckus
09/14/2018, 8:59 PMelect
09/14/2018, 9:00 PMroot
.apply {
animated = false
applyCss()
layout()
val image = snapshot(SnapshotParameters(), WritableImage(1000, 700))
val file = File("chart.png")
ImageIO.write(SwingFXUtils.fromFXImage(image, null), "png", file)
}
Ruckus
09/14/2018, 9:02 PMsnapshot(null, WritableImage(width, height))
?elect
09/14/2018, 9:02 PMelect
09/14/2018, 9:04 PMwidth
and height
appears to be both 0.0
..Ruckus
09/14/2018, 9:04 PMelect
09/14/2018, 9:04 PMRuckus
09/14/2018, 9:06 PMclass MyView : View() {
override val root = scatterchart("WBCC Clustering by Age", NumberAxis(), NumberAxis()) {
patients.multiKMeansCluster(k = 3,
maxIterations = 10000,
trialCount = 50,
xSelector = { it.age.toDouble() },
ySelector = { it.whiteBloodCellCount.toDouble() }
).forEachIndexed { index, centroid ->
series("Group ${index + 1}") {
centroid.points.forEach {
data(it.age, it.whiteBloodCellCount)
}
}
}
setOnMouseClicked {
val image = snapshot(null, WritableImage(width.toInt(), height.toInt()))
val file = File("chart.png")
ImageIO.write(SwingFXUtils.fromFXImage(image, null), "png", file)
}
}
}
elect
09/14/2018, 9:07 PMRuckus
09/14/2018, 9:09 PMelect
09/14/2018, 9:09 PMThread.sleep
doesnt seem usefulelect
09/14/2018, 9:10 PMRuckus
09/14/2018, 9:10 PMpause
.elect
09/14/2018, 9:11 PMelect
09/14/2018, 9:11 PMRuckus
09/14/2018, 9:12 PMRuckus
09/14/2018, 9:14 PMrunLater
elect
09/14/2018, 9:14 PMelect
09/14/2018, 9:14 PMRuckus
09/14/2018, 9:15 PMrunLater {
val image = snapshot(null, WritableImage(width.toInt(), height.toInt()))
val file = File("chart.png")
ImageIO.write(SwingFXUtils.fromFXImage(image, null), "png", file)
primaryStage.close()
}
elect
09/14/2018, 9:15 PMprimaryStage.close()
?Ruckus
09/14/2018, 9:16 PMelect
09/14/2018, 9:16 PMRuckus
09/14/2018, 9:16 PMrunLater
.Ruckus
09/14/2018, 9:16 PMelect
09/14/2018, 9:16 PMRuckus
09/14/2018, 9:24 PMelect
09/14/2018, 9:25 PMelect
09/14/2018, 9:25 PMrunLater {
elect
09/14/2018, 9:25 PMDuration
Ruckus
09/14/2018, 9:26 PMRuckus
09/14/2018, 9:26 PMrunLater
?elect
09/14/2018, 9:26 PMrunLater(Duration) {
Ruckus
09/14/2018, 9:27 PMelect
09/14/2018, 9:27 PM