JSFiddle - React, Tailwind, and code Playground
HTML
<script type="text/javascript" src="http://www.highcharts.com/js/testing-stock-exporting.js"></script>
<div id="container1" style="min-width: 500px"></div>
<div id="container2" style="min-width: 500px"></div>
JavaScript
var options = {
chart: {
renderTo: 'container',
alignTicks: false,
marginRight: 100
},
rangeSelector: {
selected: 1
},
title: {
},
legend: {
enabled: true,
align: 'right',
verticalAlign: 'middle',
layout: 'vertical'
},
series: []
}
$(function() {
$.getJSON('http://www.highcharts.com/samples/data/jsonp.php?filename=aapl-ohlcv.json&callback=?', function(data) {
// split the data set into ohlc and volume
var ohlc = [],
volume = [],
dataLength = data.length;
for (i = 0; i < dataLength; i++) {
ohlc.push([
data[i][0], // the date
data[i][1], // open
data[i][2], // high
data[i][3], // low
data[i][4] // close
]);
volume.push([
data[i][0], // the date
data[i][5] // the volume
])
}
// set the allowed units for data grouping
var groupingUnits = [[
'week', // unit name
[1] // allowed multiples
], [
'month',
[1, 2, 3, 4, 6]
]];
// create the chart
var chart1 = new Highcharts.StockChart($.extend(true, {}, options, {
chart: {
renderTo: 'container1',
height: 250
},
navigator: {
enabled: false
},
scrollbar: {
enabled: false
},
yAxis: {
title: {
text: 'OHLC'
}
},
series: [{
type: 'candlestick',
name: 'AAPL',
data: ohlc,
dataGrouping: {
units: groupingUnits
...