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>
<input type="button" id="add" value="add"/>
<input type="button" id="remove" value="remove"/>
JavaScript
$(function() {
var points,
chart;
$.getJSON('http://www.highcharts.com/samples/data/jsonp.php?filename=aapl-c.json&callback=?', function(data) {
points = data;
// Create the chart
chart = new Highcharts.StockChart({
chart : {
renderTo : 'container'
},
rangeSelector : {
selected : 1
},
title : {
text : 'AAPL Stock Price'
},
series : [{
name : 'AAPL',
data : points,
tooltip: {
valueDecimals: 2
}
}]
});
});
$('#add').click(function() {
chart.series[0].setData(points);
});
$('#remove').click(function() {
chart.series[0].setData([]);
});
});