[英]JAVAFX LineChart Hide/Show lines
Is it possible to show/hide certain lines in a linechart
by click on the legend or does it have to be implemented manually? 是否可以显示/隐藏在某一线
linechart
通过点击传说或者它必须手动执行?
Sincerely. 真诚。
Maybe each line can be a serie, and then you can alter the select line using css. 也许每行可以是一个系列,然后您可以使用CSS更改选择行。 I used it to change the color of the selected data from a table view.
我用它来更改表视图中所选数据的颜色。
table.getSelectionModel() .selectedIndexProperty() .addListener((observable, oldValue, newValue) -> colorPeak(oldValue, newValue)); public void colorPeak(Number oldV, Number newV) { if (oldV.intValue() != -1) { lineChart.getData().get(oldV.intValue()).getNode().setId("serie-unselect"); } if (newV.intValue() != -1) { lineChart.getData().get(newV.intValue()).getNode().setId("serie-select"); } }
#serie-unselect { -fx-stroke: blue; } #serie-select { -fx-stroke: //color of the background }
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.