title: Compressing/Expanding JavaFX 2 data chart
body: <p>Having a XY Line Chart I would like compress/expand data visualization both for X and Y axis by left mouse click, keep pressed and drag left/right and up/down.</p>
  
  <p>Here is a chart example</p>
  
  <p><img src="https://i.stack.imgur.com/BFDrH.png" alt="enter image description here"></p>
  
  <p>and here is the code to plot sample data</p>
  
  <pre><code>public class BaseXYChart extends Application {
  
  @Override
  public void start(Stage stage) {
     stage.setTitle("Linear plot");
  
     final CategoryAxis xAxis = new CategoryAxis();
     final NumberAxis yAxis = new NumberAxis(1, 22, 0.5);
  
     yAxis.setTickLabelFormatter(new NumberAxis.DefaultFormatter(yAxis){
          @Override
      public String toString(Number object){
          return String.format("%7.2f", object);
      }
  });
  final LineChart&lt;String, Number&gt;lineChart = new LineChart&lt;String, Number&gt;(xAxis, yAxis);
  
     lineChart.setCreateSymbols(false);
     lineChart.setAlternativeRowFillVisible(false);
     lineChart.setLegendVisible(false);
  
     XYChart.Series series1 = new XYChart.Series();
  
      series1.getData().add(new XYChart.Data("Jan", 1));
      series1.getData().add(new XYChart.Data("Feb", 1.5));
      series1.getData().add(new XYChart.Data("Mar", 2));
      series1.getData().add(new XYChart.Data("Apr", 2.5));
      series1.getData().add(new XYChart.Data("May", 3));
      series1.getData().add(new XYChart.Data("Jun", 4));
      series1.getData().add(new XYChart.Data("Jul", 6));
      series1.getData().add(new XYChart.Data("Aug", 9));
      series1.getData().add(new XYChart.Data("Sep", 12));
      series1.getData().add(new XYChart.Data("Oct", 15));
      series1.getData().add(new XYChart.Data("Nov", 20));
      series1.getData().add(new XYChart.Data("Dec", 22));
  
      BorderPane pane = new BorderPane();
      pane.setCenter(lineChart);          
      Scene scene = new Scene(pane, 800, 600);
      lineChart.getData().addAll(series1);
  
      stage.setScene(scene);
      stage.show();
  }
  
  public static void main(String[] args) {
      launch(args);
  }   
  }
  </code></pre>
  
  <p>How can I accomplish this? I haven't found any examples anywhere!</p>
  
  <p>Thanks.</p>
  
  <p>Add picture</p>
  
  <p><img src="https://i.stack.imgur.com/h9qmJ.png" alt="Result after left mouse click, pressed and drag on Y Axis from top to bottom"></p>
  
  <p>Result after left mouse click, pressed and drag on Y Axis from top to bottom</p>
  
  <p>Same result should be for X Axis to get a compressed line data by left/right mouse drag</p>