JSFiddle - React, Tailwind, and code Playground
HTML
<script src="http://code.highcharts.com/stock/highstock.js"></script>
<script src="http://code.highcharts.com/stock/modules/exporting.js"></script>
<div id="container" style="height: 500px; min-width: 500px"></div>
JavaScript
$(function() {
$.getJSON('http://www.highcharts.com/samples/data/jsonp.php?filename=aapl-ohlc.json&callback=?', function(data) {
// create the chart
$('#container').highcharts('StockChart', {
plotOptions: {
series: {
cursor: 'pointer',
point: {
events: {
click: function () {
alert('Date: ' + Highcharts.dateFormat('%Y-%m-%d',this.x) + 'value: ' + this.y + ', close: ' + this.close + ' open: ' + this.open + ' high: ' + this.high + ' low: ' + this.low);
}
}
}
}
},
tooltip:{
formatter:function(){
return "open: " + this.points[0].point.open + ' close: ' + this.points[0].point.close + ' high: ' + this.points[0].point.high + ' low:' + this.points[0].point.low;
}
},
rangeSelector : {
selected : 1
},
title : {
text : 'AAPL Stock Price'
},
series : [{
type : 'candlestick',
name : 'AAPL Stock Price',
data : data,
dataGrouping : {
units : [
['week', // unit name
[1] // allowed multiples
], [
'month',
[1, 2, 3, 4, 6]]
]
}
}]
});
});
});