title: Highcharts: Force show xAxis with datetime
body: <p>My highcharts chart is showing like this now:
  <a href="http://img90.imageshack.us/img90/3892/chart1p.png" rel="nofollow">http://img90.imageshack.us/img90/3892/chart1p.png</a></p>
  
  <p>But I need it to look like this:
  <a href="http://img545.imageshack.us/img545/1333/chart2p.png" rel="nofollow">http://img545.imageshack.us/img545/1333/chart2p.png</a></p>
  
  <p>Currently its not showing empty values by hours.</p>
  
  <p>My code:</p>
  
  <p>index.php</p>
  
  <pre><code>&lt;script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js"&gt;&lt;/script&gt;
  &lt;script src="http://code.highcharts.com/highcharts.js"&gt;&lt;/script&gt;
  &lt;script type="text/javascript"&gt;
      var chart;
      $(document).ready(function () {
          var options = {
              chart: {
                  renderTo: 'chart',
                  defaultSeriesType: 'spline'
              },
              title: {
                  text: 'Earnings Today',
              },
              subtitle: {
                  text: ''
              },
              xAxis: {
                  type: 'datetime',
                  tickInterval: 3600 * 1000,
                  tickWidth: 0,
                  labels: {
                      align: 'center',
                      formatter: function () {
                          return Highcharts.dateFormat('%l%p', this.value);
                      }
                  },
              },
              yAxis: {
                  title: {
                      text: 'Earnings'
                  },
                  min: 0,
                  tickInterval: 2,
              },
              plotOptions: {
                  spline: {
                      marker: {
                          radius: 4,
                          lineColor: '#666666',
                          lineWidth: 1
                      }
                  }
              },
              tooltip: {
                  valueDecimals: 2,
                  crosshairs: true,
                  formatter: function () {
                      return '$' + this.y;
                  }
              },
              series: [{
                      name: 'Earnings Today, USD'
                  }
              ]
          }
          jQuery.get('data_today.php', null, function (tsv) {
              var lines = [];
              earnings = [];
              try {
                  tsv = tsv.split(/\n/g);
                  jQuery.each(tsv, function (i, line) {
                      line = line.split(/\t/);
                      date = Date.parse(line[0] + ' UTC');
                      val = line[1];
                      earnings.push([date, parseFloat(line[1].replace(',', '.'), 10)]);
                  });
              } catch (e) {}
              options.series[0].data = earnings;
              chart = new Highcharts.Chart(options);
          });
      });
  &lt;/script&gt;
  </code></pre>
  
  <p>data_today.php</p>
  
  <pre><code>&lt;?php
  session_start();
  require_once('config.php');
  require_once('config_mysql.php');
  
  $link = mysql_connect(DB_HOST, DB_USER, DB_PASSWORD);
  if (!$link)
  {
      die('Failed to connect to server: ' . mysql_error());
  }
  
  $db = mysql_select_db(DB_DATABASE);
  if (!$db)
  {
      die("Unable to select database");
  }
  
  $result = mysql_query("SELECT earn_date,SUM(amount) as val FROM user_earnings WHERE user_id='$USER_ID' AND DATE(earn_date) = DATE(NOW()) GROUP BY earn_date");
  if ($result)
  {
      while ($row = mysql_fetch_array($result))
      {
          $d = date("l, F, j, Y G:i:s", strtotime($row["earn_date"]));
          echo $d . "\t" . $row['val'] . "\n";
      }
  }
  else
  {
      die(mysql_error());
  }
  mysql_close($link);
  ?&gt; 
  </code></pre>
  
  <p>So, (if its not enough clear yet) I need this code to show whole day and show also empty values by hour.</p>
  
  <p>I have almost zero experience of highcharts and javascript, so I need some help with this :)</p>
  
  <p>Also looking for alternative way for running MySql query inside index.php so I dont need data_today.php</p>
  
  <p>Thanks</p>