0
我使用折線圖作爲條形圖(由於某些原因),並在px中動態設置線條(bar)筆畫寬度。但似乎增加了行的行程寬度,也增加了其長度,這不是預期的。筆畫寬度javafx折線圖的異常行爲
Both are programmatically set to T1,10 and T2,30
此代碼負責設置動態地基於在x軸上的項目編號的行筆劃寬度。
private void setGreenBar(Node node, double barWidth){
node.setStyle("-fx-stroke: greenyellow; -fx-stroke-width: " + barWidth + "px;");
}
private void setRedBar(Node node, double barWidth){
node.setStyle("-fx-stroke: red; -fx-stroke-width: " + barWidth + "px;");
}
大概這一切都取決於你通過什麼樣的'節點'。 –