JSFiddle - React, Tailwind, and code Playground
by navindian
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>
JavaScript
$(function() {
$.getJSON('http://www.highcharts.com/samples/data/jsonp.php?filename=usdeur.json&callback=?', function(data) {
// Create the chart
window.chart = new Highcharts.StockChart({
chart : {
renderTo : 'container'
},
rangeSelector : {
selected : 1
},
title : {
text : 'USD to EUR exchange rate'
},
plotOptions : {
line : {
lineWidth : 1
},
series : {
showCheckbox : true,
events : {
legendItemClick : function(event) {
alert( window.chart.series[0].visible)
alert( window.chart.series[1].visible)
alert( window.chart.series[2].visible)
}
}
}
},
legend : {
floating : false,
verticalAlign : 'top',
y : 50,
shadow : true,
enabled : true,
align : 'left',
layout : 'vertical',
padding : 20,
itemWidth : -2,
itemStyle : {
color : '#cccccc'
},
itemHoverStyle : {
color : '#ffffff'
},
itemHiddenStyle : {
color : '#333333'
}
},
tooltip: {
style: {
width: '200px'
},
valueDecimals: 4
},
yAxis : {
title : {
text : 'Exchange rate'
}
},
series : [{
name : 'USD to EUR',
data : data,
id : 'dataseries'
},
// the event marker flags
{
type : 'flags',
data : [{
...