I am trying to create my JavaFX linear string, but I have some problems with the legend.
I know how to change the color of a line chart legend in a css file:
.default-color0.chart-series-line { -fx-stroke: #FF0000, white; }
.default-color1.chart-series-line { -fx-stroke: #00FF00, white; }
.default-color2.chart-series-line { -fx-stroke: #0000FF, white; }
.default-color0.chart-line-symbol { -fx-background-color: #FF0000, white; }
.default-color1.chart-line-symbol { -fx-background-color: #00FF00, white; }
.default-color2.chart-line-symbol { -fx-background-color: #0000FF, white; }
But this is not enough for my purposes. I have three or more color toggle buttons and a series of data for each button. The data should be displayed in the same color that the button has after I selected the button. This should be possible with multiple button selections, so that more than one series of data can be displayed at a time.
For the chart lines, I dealt with this by changing the style after clicking the button:
..
dataList.add(series);
..
series.getNode().setStyle("-fx-stroke: rgba(" + rgba + ")");
If I deselect a button, I will remove the data from the list.
dataList.remove(series);
This works great for punches, but how can I do the same for a legend?
. , ( -color0). . . , , color1, , .
