title: Mouse event when clicking data title in JavaFX
body: <p>I have created a simple horizontal barchart using JavaFX in Java 1.8. This displays correctly with a bottom legend, list of paths on the left and bars showing data grouped into 3 series. I would like to open a page that is dynamically populated based on the path chosen with the path on the left used as the link but I have not been able to find a way to create a mouse event when clicking on that data text.</p>
  
  <p>In the sample code below the text retrieved by my "path" class's "getpath" method is what I would like to turn into a link.
  Is there anyway to do this?</p>
  
  <p>I've reviewed documentation on the BarChart and XYChart classes but I cannot find a way to get the value of a given item in the chart, and even if a did I cannot set an action event because the data value doesn't appear to have a specific node to set the event on.
  Doing this with a button and/or drop down works as expected but i'd like to use the text built into the chart as a link.
  Most of the other similar questions I have found referenced using a label for the title but that won't work in this case as the number of items in my chart will vary on the dataset passed into it.</p>
  
  <pre><code>//method for building chart
   protected BarChart getChart(ObservableList&lt;myClass&gt; chartData) {
      //Setup a horizontal barchart for displaying heat stats.
  
      final NumberAxis xAxis = new NumberAxis();
      final CategoryAxis yAxis = new CategoryAxis();
  
      final BarChart&lt;Number,String&gt; bc = 
          new BarChart&lt;Number,String&gt;(xAxis,yAxis);
      bc.setTitle("");
      xAxis.setLabel("Ops");  
      xAxis.setTickLabelRotation(90);
      yAxis.setLabel("NFS Exports with lock contention");        
  
  
      //Create series to hold data for each event type to show 
      XYChart.Series series1= new XYChart.Series();
      series1.setName("Series1");  
      XYChart.Series series2= new XYChart.Series();
      series2.setName("Series2");
      XYChart.Series series3= new XYChart.Series();
      series3.setName("Series3");       
  
  
      for (myClass path: chartData)
      {
          series1.getData().add(new XYChart.Data(path.getData1(), path.getPath()));
          series2.getData().add(new XYChart.Data(path.getData2(), path.getPath()));
          series3.getData().add(new XYChart.Data(path.getData3(), path.getPath()));
      }    
      bc.getData().addAll(series1, series2, series3);
      return bc;                
  }
  
  
  //method for getting sample data
   public ObservableList&lt;myClass&gt; getPathData()
      {
          ObservableList&lt;myClass&gt; exports = FXCollections.observableArrayList();
          paths.add(new myClass("/path1", 12.0, 30.0, 62.0));
          paths.add(new myClass("/path2", 20.0, 43.0, 82.0));
          paths.add(new myClass("/path3", 0.0, 18.0, 23.0));
          paths.add(new myClass("/path4", 40.0, 26.0, 75.0));
          paths.add(new myClass("/path5", 8.0, 4.0, 5.0));
          return paths;
      }
  </code></pre>
  
  <p>What I would like is a way to make clicking on the path run a function passing in the path that was selected.</p>