Using only Time Value on x axis - CanvasJS

Using only Time Value on x axis - CanvasJS

by canvasjs

HTML

<script src="https://canvasjs.com/assets/script/canvasjs.min.js"></script>
<body>
  <div id="chartContainer" style="height: 300px; width: 100%;">
  </div>
</body>

JavaScript

var chart = new CanvasJS.Chart("chartContainer",
{
	title: {
		text: "Demo for Time Value Format",
	},
	axisX:{
		intervalType: "hour",
		interval: 1,
		valueFormatString: "hh:mm:ss tt", 
	},
	data: [
	{
		type: "line",
		dataPoints: [
			{ x: new Date("2014-09-23 00:00:00"), y: 50 },
			{ x: new Date("2014-09-23 01:00:00"), y: 65 },
			{ x: new Date("2014-09-23 02:00:00"), y: 95 },
			{ x: new Date("2014-09-23 03:00:00"), y: 68 },
			{ x: new Date("2014-09-23 04:00:00"), y: 28 },
			{ x: new Date("2014-09-23 05:00:00"), y: 34 },
			{ x: new Date("2014-09-23 06:00:00"), y: 55 }
		]
	}
	]
});
chart.render();