2016-11-11 3 views
3

私は、テストに合格するために70%以上を必要とするテストプログラムを作成しています。 LineChartと1つのシリーズを設定しました。これはパーセント値と日付を座標として取ります。私は> = 70%の緑色と残りの赤色のノードに色付けしたいと思います。コードフラグメントは次のとおりです。特定のノードのスタイルを1つのシリーズで設定する - JavaFX

問題は、特定のノードを1つのシリーズに色付けできないという問題です。 誰かが私を助けてくれることを願っています。

+0

これを行うには、Cssが最適です。あなたはScenebuilderを使っていますか? – Sedrick

+0

あなたのツールチップがマウス上で動作しているのが不思議ですか?私がここで何をしたかを見ないと。 http://stackoverflow.com/questions/14615590/javafx-linechart-hover-values/40431880#40431880 – Sedrick

答えて

1

このようなものから始めなければなりません。

//If you only have one series all you need is this first block of code 
Set<Node> node = lineChart.lookupAll(".default-color0.chart-line-symbol.series0.");      
    node.forEach((element) -> { 
     //do somthing to each node in series0 
     System.out.println(element.toString());//don't know if this will work. If it does it will all you to see each node. At the very least the node address. 
}); 

//If you have two series you need this. If you have more thant two series you need to copy this and change node2 to node3 everywhere in your copy. 
Set<Node> node2 = lineChart.lookupAll(".default-color1.chart-line-symbol.series1.");      
    node2.forEach((element) -> { 
     //do somthing to each node in series1 
     System.out.println(element.toString());//don't know if this will work. If it does it will all you to see each node. At the very least the node address. 
}); 
関連する問題