JSFiddle - React, Tailwind, and code Playground
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: 500px; width: 50%;"></div>
JavaScript
var chart = new CanvasJS.Chart("chartContainer", {
axisY: {
//minimum: (new Date(2012, 01, 1)).getTime(),
//interval: (12 * 60 * 60 * 1000),
reversed: true,
labelFormatter: function(e){
return CanvasJS.formatDate(e.value, "DD MMM YYYY");
}
},
toolTip:{
contentFormatter: function ( e ) {
return CanvasJS.formatDate(e.entries[0].dataPoint.y, "DD MMM YY") + " : " + e.entries[0].dataPoint.x;
}},
data: [{
type: "line",
dataPoints: [
{ x: 26, y: new Date(2012, 01, 1).getTime() },
{ x: 38, y: new Date(2012, 01, 3).getTime() },
{ x: 43, y: new Date(2012, 01, 5).getTime() },
{ x: 29, y: new Date(2012, 01, 7).getTime() },
{ x: 41, y: new Date(2012, 01, 11).getTime()},
{ x: 54, y: new Date(2012, 01, 13).getTime()},
{ x: 66, y: new Date(2012, 01, 20).getTime()},
{ x: 60, y: new Date(2012, 01, 21).getTime()},
{ x: 53, y: new Date(2012, 01, 25).getTime()},
{ x: 60, y: new Date(2012, 01, 27).getTime()}
]
}]
});
chart.render();