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>
<button>Add point</button>
<div id="container" style="height: 500px"></div>
JavaScript
jQuery(function() {
// Create the chart
window.chart = new Highcharts.StockChart({
chart: {
renderTo: 'container'
},
rangeSelector: {
selected: 1
},
title: {
text: 'USD to EUR exchange rate'
},
xAxis: {
maxZoom: 14 * 24 * 3600000 // fourteen days
},
yAxis: {
title: {
text: 'Exchange rate'
}
},
series: [{
type: 'ohlc',
name: 'USD to EUR',
data: ohlcdata
}]
}, function(chart){
$('button').click(function(){
var d = chart.series[0].data,
x = d[d.length-1].x + 7*24*3600*1000;
chart.series[0].addPoint([x, 0.7341, 0.7385, 0.7291, 0.7304])
})
});
});