title: How to start and end a dynamically generetad datetime highchart's xAxis on the first and last tick
body: <p>I have several different highcharts that all can vary on what date-time they start and stop, so a hard-coded solution will not work.</p>
  
  <p><strong>What I am trying to achieve</strong> is to have the xAxis labels start at the first data point's datetime, and end at the last point's datetime. </p>
  
  <p>What highchart allows me to do is some thing like this</p>
  
  <pre><code>xAxis: {
          startOnTick: true,
          endOnTick: true,
          showFirstLabel: true,
          showLastLabel: true
  }
  </code></pre>
  
  <p>This simply means the xAxis itself starts and ends on <em>a</em> tick, not necessarily the first and last tick of data. It also show a large padding/space at the left and right side of the chart to make sure the xAxis can start and and end on a tick, but as I said, these rules don't regard the series content, and simply start and end on whatever tick interval the chart calculates on its own. </p>
  
  <p><strong>Ideally</strong>, a chart that has data from "1 jan. 2017" to "20 feb. 2017"  should have labels that that with 1 jan. and end with 20 feb. </p>
  
  <p><strong>Instead</strong>, the chart will maybe start with 5 jan. and end on 15 feb. which I think it does to accommodate vertical space for the labels.</p>
  
  <p>I suspect maybe it could be possible to take the data length, and calculate a perfect amount of steps so it shows the first and last date? </p>