Line chart with date x axis - CanvasJS

Line chart with date x axis

by mpigott7627272

HTML

<script src="https://canvasjs.com/assets/script/canvasjs.min.js"></script>
<br/><!-- Just so that JSFiddle's Result label doesn't overlap the Chart -->
<div id="chartContainer" style="height: 360px; width: 100%;"></div>

JavaScript

var chart = new CanvasJS.Chart("chartContainer", {
  title:{
    text: "Line chart with date x axis"
  },
  axisX: 
  {
  	interval: 7,
    intervalType: "day",
    minimum: new Date(2020,3,14),
    valueFormatString: "DD/MM/YYYY",
  },
  data: [{
  	type: "line", 
    dataPoints: [
      { x: new Date(2020,3,14), y: 71 },
      { x: new Date(2020,3,16), y: 55},
      { x: new Date(2020,3,17), y: 50 },
      { x: new Date(2020,3,22), y: 65 },
      { x: new Date(2020,3,23), y: 95 },
      { x: new Date(2020,3,24), y: 68 },
      { x: new Date(2020,3,28), y: 28 },
      { x: new Date(2020,3,30), y: 34 },
      { x: new Date(2020,4,1), y: 14}
    ]
  }]
});

chart.render();