Class ChartOverlay


  • public class ChartOverlay
    extends ChartPlugin
    Plugin that overlays chart pane or chart's plot area with given node i.e. the bounds of the node are set to cover the indicated area.

    Typically the node would be a an instance of Pane containing child nodes. The example below shows how to add a Label to the chart pane, located in the left top corner of the plot area:

     XYChartPane<Number, Number> chartPane = ...;
    
     Label label = new Label("Info about chart data");
     AnchorPane.setTopAnchor(label, 5.0);
     AnchorPane.setLeftAnchor(label, 5.0);
     AnchorPane anchorPane = new AnchorPane(label);
     // Pass any mouse events to the underlying chart
     anchorPane.setMouseTransparent(true);
    
     chartPane.getPlugins().add(new ChartOverlay<>(OverlayArea.PLOT_AREA, anchorPane));
     
    Author:
    Grzegorz Kruk
    • Method Detail

      • getNode

        public final javafx.scene.Node getNode()
        Returns the value of the nodeProperty().
        Returns:
        the node to be overlaid
      • layoutChildren

        public void layoutChildren()
        Description copied from class: ChartPlugin
        Optional method that allows the plug-in to react in case the size of the chart that it belongs to has changed.
        Overrides:
        layoutChildren in class ChartPlugin
      • nodeProperty

        public final javafx.beans.property.ObjectProperty<javafx.scene.Node> nodeProperty()
        The node to be overlaid on top of the overlay area.
        Returns:
        the node property
      • setNode

        public final void setNode​(javafx.scene.Node newNode)
        Sets the value of the nodeProperty().
        Parameters:
        newNode - the node to overlaid