JSFiddle - React, Tailwind, and code Playground
HTML
<script src="http://highcharts.com/js/highcharts.js"></script>
<div id="container" style="height: 400px; width: 500px"></div>
JavaScript
var pointsBuild = [];
for(i=0; i<10; i++)
pointsBuild.push([Date.UTC(2011, 0, i), Math.random()]);
buildGraph(pointsBuild);
function buildGraph (pointsArray) {
//var pointsJSON = JSON.stringify(pointsArray);
//console.log(pointsJSON);
chart = new Highcharts.Chart({
chart: {
renderTo: 'container',
defaultSeriesType: 'spline',
animation: {
easing: 'linear'
}
},
title: {
text: 'Graph Title'
},
xAxis: {
type: 'datetime',
dateTimeLabelFormats: {
month: '%b %y'
}
},
yAxis: {
title: {
text: 'Y Axis Title'
},
plotLines: [{
value: 0,
width: 1,
color: '#808080'
}]
},
tooltip: {
formatter: function() {
return Highcharts.dateFormat('%e %b %y', this.x) +': '+ this.y;
}
},
legend: {
enabled: false
},
credits: {
enabled: false
},
series: [{
data: pointsArray
}]
});
}