JSFiddle - React, Tailwind, and code Playground
HTML
<script type="text/javascript" src="http://www.highcharts.com/js/testing-stock-exporting.js"></script>
<script type="text/javascript" src="http://www.highcharts.com/samples/data/usdeur.js"></script>
<div id="container" style="height: 500px"></div>
<button>toggle flags</button>
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: [{
id: 'series1',
name: 'USD to EUR',
data: usdeur
},{
type: 'flags',
name: 'Flags on series',
data: [{
x: Date.UTC(2011, 1, 14),
title: 'flag 1'
}, {
x: Date.UTC(2011, 3, 28),
title: 'flag 2'
},{
x: Date.UTC(2011, 2, 1),
title: 'flag 3'
}, {
x: Date.UTC(2011, 3, 1),
title: 'flag 4'
}],
onSeries: 'series1',
shape: 'squarepin'
}]
}, function(chart){
$('button').click(function(){
var serie = chart.series[1];
serie[serie.visible ? 'hide' : 'show']();
})
});
});