title: Fix X and Y axis widths, JavaFX
body: <p>How can I achieve fixed Axis width using JavaFx line graph.</p>
  
  <pre><code>import javafx.animation.Timeline;
  import javafx.application.Application;
  import javafx.scene.Scene;
  import javafx.scene.chart.LineChart;
  import javafx.scene.chart.NumberAxis;
  import javafx.stage.Stage;
  
  public class Axis extends Application
  {
  
      private Timeline animation;
  
      public static void main(final String[] args)
      {
          launch(args);
      }
  
      @Override
      public void start(final Stage stage) throws Exception
      {
          final NumberAxis x = new NumberAxis();
          final NumberAxis y = new NumberAxis();
          x.setAutoRanging(false);
          y.setAutoRanging(false);
  
          final LineChart&lt;Number, Number&gt; lineChart = new LineChart&lt;Number, Number&gt;(x, y);
          // final Series series = new LineChart.Series&lt;Number, Number&gt;();
          //
          // series.getData().add(new XYChart.Data(20, 23));
          // series.getData().add(new XYChart.Data(35, 14));
          // series.getData().add(new XYChart.Data(43, 15));
          // series.getData().add(new XYChart.Data(60, 24));
          // series.getData().add(new XYChart.Data(10, 34));
          //
          // lineChart.getData().add(series);
          lineChart.setPrefHeight(10);
          lineChart.setPrefWidth(10);
          lineChart.setMinHeight(10);
          lineChart.setMinWidth(10);
          lineChart.setMaxHeight(10);
          lineChart.setMaxWidth(10);
  
          final Scene scene = new Scene(lineChart, 800, 800);
          stage.setScene(scene);
          stage.show();
  
      }
  
      @Override
      public void stop()
      {
          animation.pause();
      }
  }
  </code></pre>
  
  <p><img src="https://i.stack.imgur.com/XhYVC.jpg" alt="enter image description here"></p>
  
  <p>I would like the grid (sample marked in red) not to scale when I resize the window. Currently the grid resizes when the window is resized as shown below</p>
  
  <p><img src="https://i.stack.imgur.com/b1crS.jpg" alt="enter image description here"></p>
  
  <p>I am not able to achieve what I need using the minWidth and maxWidth API's</p>