Home forums Using CanvasJS Excluding Date on X Axis when no data Reply To: Excluding Date on X Axis when no data

#12549

gtsafas
Participant

I modified one of your demos below. See how there is only 3/1 and 3/5. I only want to see 3/1 and 3/5 on the x axis. I cant seem to find a setting to do that.

<!DOCTYPE HTML>
<html>
<head>
  <script type="text/javascript">
  window.onload = function () {
    var chart = new CanvasJS.Chart("chartContainer",
    {
      title:{
        text: "Date time axis with interval 3 months"
      },
      axisX:{
        interval: 0,
        intervalType: "day"
      },
      data: [
      {
        type: "line",
        dataPoints: [//array
        {
         x: new Date(2012, 03, 1),
         y: 26,
       },
       {
         x: new Date(2012, 03, 5),
         y: 38
       }
    
       ]
     }
     ]
   });

    chart.render();
  }
  </script>
  <script type="text/javascript" src="/assets/script/canvasjs.min.js"></script>
</head>
<body>
  <div id="chartContainer" style="height: 300px; width: 100%;">
  </div>
</body>
</html>