我是 groovyfx 部分的新手,我不明白如何保持地图的迭代
谁可以帮我这个事
提前致谢
import javafx.collections.FXCollections
import javafx.scene.chart.PieChart
import static groovyx.javafx.GroovyFX.start
final pieData = FXCollections.observableArrayList([new PieChart.Data("Yours", 42), new PieChart.Data("Mine", 58)])
def map = [
'Firstpersonmarks' : 20,
'secondpersonmarks' : 30,
'thirdpersonmarks' : 40,
'fourthpersonmarks' : 100
]
start {
stage(title: 'GroovyFX Chart Demo', width: 1024, height: 960, visible: true) {
scene {
stackPane {
scrollPane {
tilePane(padding: 10, prefTileWidth: 480, prefColumns: 2) {
map.each { println "Hex Code: $it.key = Color Name: $it.value" }
for (entry in map) {
println(data:[" $entry.key : $entry.value"])
pieChart(data: [" $entry.key : $entry.value"])
}
stackPane(alignment: TOP_RIGHT) {
pieChart(data: pieData, animated: true)