Repository navigation
How to show / hide datasets with ContourDataSetRenderer?
#715
Replies: 1 comment 1 reply
|
You can toggle the DataSetNode series = renderer.getStyleableNode(histogram);
button.setOnAction(event -> series.setVisible(!series.isVisible()));Call This runnable example uses two external toggle buttons with a hidden legend. Scripted offscreen JavaFX checks on ChartFX 11.3.1 verified repeated individual toggles, both hidden then restored, unchanged data/node identities and the actual rendered canvas. The example includes imports and the Maven setup; it hasn't been tested in your application. |

You can toggle the
DataSetNodebelonging to that dataset in yourContourDataSetRenderer. This is the same visibility property the built-in legend changes:Call
getStyleableNodeafter adding that exact dataset object to the renderer. If you're adding it there,DataSetNode series = renderer.addDataSet(histogram);returns the node directly. The data stays attached; there's no reload or removal. If it also appears in another renderer, that renderer has a separate node to toggle.This runnable example uses two external toggle buttons with a hidden legend. Scripted off…