title: JavaFX Area Chart: Set Mouse transparency on XYChart Area but not it's child Data Node
body: <p>Been scratching my head and researching this for awhile with no luck.</p>
  
  <p>I have a javaFX project in which I have created a areachart with 4 sets of series the last of which only has points visible (black Xs):</p>
  
  <p><img src="https://i.stack.imgur.com/HrTdD.jpg" alt=""></p>
  
  <p>I have also implemented the ability to drill down into the chart by highlighting an area.  This is all down via various mouse handlers, but essentially it is a translucent yellow rectangle (highlight) that re-sizes as the mouse is dragged:</p>
  
  <pre><code>    private void setMouseHandler() {
  final Axis&lt;Date&gt; xAxis = gcChart.getXAxis();
  final Axis&lt;Number&gt; yAxis = gcChart.getYAxis();        
  final Node chartBackground = gcChart.lookup(".chart-plot-background");
  for (Node n: chartBackground.getParent().getChildrenUnmodifiable()) {
      if (n != chartBackground &amp;&amp; n != xAxis &amp;&amp; n != yAxis &amp;&amp; n != highlight) {
      n.setMouseTransparent(true);
      }
  }   
  chartBackground.setOnMouseEntered(new EventHandler&lt;MouseEvent&gt;() {
  
      @Override 
      public void handle(MouseEvent mouseEvent) {
      if (mouseEvent.isPrimaryButtonDown()){
          exitedChart = false;
      }
      }
  
  });
  
  
  //grab the initial values so if dragged we have them
  chartBackground.setOnMousePressed(new EventHandler&lt;MouseEvent&gt;() {
  
      @Override 
      public void handle(MouseEvent mouseEvent) {     
  
      if (mouseEvent.isPrimaryButtonDown()){
              Bounds chartAreaBounds = yAxis.localToParent(yAxis.getBoundsInParent()); //chartBackground.localToScene(chartBackground.getBoundsInLocal());                                  
              xShift = chartAreaBounds.getMaxX() -10;  //account for Y Axis area on the chart and side tabs
              origX = mouseEvent.getX() + xShift;
              highlight.setVisible(true);
              highlight.setX(origX);
              highlight.setY(chartAreaBounds.getMinY()+xAxis.getHeight());
              highlight.setHeight(chartAreaBounds.getMaxY()-xAxis.getHeight());
  
              // Don't want to re-render the chart if we are already zoomed out.      
              firstSelDate = xAxis.getValueForDisplay(mouseEvent.getX());
      }
      else{
       // Are we zoomed in?
          if (seriesCache.size() &gt;= 2){
              logger.info("Zooming out of chart");
              Platform.runLater(new Runnable() {
  
              @Override
              public void run() {
                  removeChartFromScene();
                  // return to last series in cache
                  new Thread(new GenerateDataTask(null, null, true)).start();
              }
  
              });
              firstSelDate = null;
          }
      }
  
      }
  
  });
  
  //must enable FullDrag to detect a drag entering into nodes other than the chart ie. highlight
  chartBackground.setOnDragDetected(new EventHandler&lt;MouseEvent&gt;() {
  
      @Override 
      public void handle(MouseEvent mouseEvent) {
      if (mouseEvent.isPrimaryButtonDown()){
          chartBackground.startFullDrag();
      }
      }
  
  });
  
  chartBackground.setOnMouseDragged(new EventHandler&lt;MouseEvent&gt;() {
  
      @Override 
      public void handle(MouseEvent mouseEvent) {
      if (mouseEvent.isPrimaryButtonDown()){
              //only set drag values if in the bounds of yAxis
              if (!exitedChart){
                  double position = mouseEvent.getX() + xShift;
                  highlight.setX(origX &lt;= position? origX : position);                    
                  highlight.setWidth(origX &lt;= position? position-origX: origX-position);
  
                  // this may be whats causing the slow drag..
                  lastSelDate = xAxis.getValueForDisplay(mouseEvent.getX());   
              }
      }
      }
  
  });     
  chartBackground.setOnMouseReleased(new EventHandler&lt;MouseEvent&gt;() {
  
      public void handle(MouseEvent mouseEvent) {     
          //Check if drag was backwards and if so swap dates
          if (lastSelDate!=null &amp;&amp; firstSelDate.compareTo(lastSelDate)&gt;0){
              Date tempDate = firstSelDate;
              firstSelDate=lastSelDate;
              lastSelDate=tempDate;
          }
          //mouse has been released so cleanup the highlight
          highlight.setX(0);
          highlight.setWidth(0);
          highlight.setVisible(false);
          //Set both sets of series in the chart to the subset selected
          if (lastSelDate != null &amp;&amp; firstSelDate.compareTo(lastSelDate) != 0) {
              logger.info("Zooming into chart");
              removeChartFromScene();
              // show the subset of data
              new Thread(new GenerateDataTask(firstSelDate, lastSelDate, false)).start();
  
          }
          lastSelDate = null;
  
      }
  
  });
  yAxis.setOnMouseDragEntered(new EventHandler&lt;MouseDragEvent&gt;() {
  
      @Override 
      public void handle(MouseDragEvent mouseEvent) {
      if (mouseEvent.isPrimaryButtonDown()){
              exitedChart = true;
  
              //Account for lag in listener when hitting the yAxis - pull highlight rigt to the edge
              highlight.setX(yAxis.getBoundsInParent().getMaxX());
              highlight.setWidth(origX-yAxis.getBoundsInParent().getMaxX());
      }
      }
  
  });
  
  //detect drag if pulled back into highlight area
  highlight.setOnMouseDragEntered(new EventHandler&lt;MouseEvent&gt;() {
  
      @Override 
      public void handle(MouseEvent mouseEvent) {
      if (mouseEvent.isPrimaryButtonDown()){
          exitedChart = false;
      }
      }
  
  });
  }
  </code></pre>
  
  <p>In order to get this highlight functionality working without a lot of headaches I set most nodes in the chart to be transparent to the mouse:</p>
  
  <pre><code>    for (Node n: chartBackground.getParent().getChildrenUnmodifiable()) {
      if (n != chartBackground &amp;&amp; n != xAxis &amp;&amp; n != yAxis &amp;&amp; n != highlight) {
      n.setMouseTransparent(true);
      }
  }
  </code></pre>
  
  <p>My problem is that I'm now trying to set tooltips on the top chart series (the black x points) however the only way I am able to get them to work is by setting those nodes as well as their parent (Group) and grandParent (XYChart) to not be transparent.  In doing this I bust the highlight functionality.  </p>
  
  <p>I have experimented with setPickOnBounds, but from what I understand that only controls whether or not the mouse "sees" invisible portions of a given Node.  If my understanding is correct that won't work in this case as the drag routine needs to ignore the visible area(s) of the series(falling through to the chart background) but not ignore the black Xs (XYChart.Data nodes).</p>
  
  <p>Is there anyway (short of rewriting the mouse handling) to make that set of series visible to the mouse without making everything else visible?</p>