JSFiddle - React, Tailwind, and code Playground
by Cupidvogel
HTML
<script type='text/javascript' src="http://code.highcharts.com/stock/highstock.js"></script>
<script type='text/javascript' src="http://code.highcharts.com/stock/modules/exporting.js"></script>
<div id="container" style="height: 438px; width: 770px;"></div>
<button id = 'clear'>Clear</button>
<button id = 'set'>Fill</button>
JavaScript
chartoptions = {
chart: {
renderTo: 'container',
alignTicks: false
},
rangeSelector: {
selected: 1
},
title: {
text: 'AAPL Stock Volume'
},
series: [{
type: 'column',
name: 'AAPL Stock Volume',
data: 5,
dataGrouping: {
units: [[
'week', // unit name
[1] // allowed multiples
], [
'month',
[1, 2, 3, 4, 6]
]]
}
}]
}
$.getJSON('http://www.highcharts.com/samples/data/jsonp.php?filename=aapl-v.json&callback=?', function(data) {
chartoptions['series'][0]['data'] = data;
// create the chart
chart = new Highcharts.StockChart(chartoptions);
});
$("#clear").click(function() { $("#container").empty(); });
$("#set").click(function() { $.getJSON('http://www.highcharts.com/samples/data/jsonp.php?filename=aapl-v.json&callback=?', function(data) {
chartoptions['series'][0]['data'] = data;
// create the chart
chart = new Highcharts.StockChart(chartoptions);
}); });