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"></div><input id="btnenabledisable" type="button" value="spline"></input>
JavaScript
$(function() {
$("#btnenabledisable").click(function() {
window.chart.getSelectedSeries()[0].type ='spline';
window.chart.getSelectedSeries()[0].options.type='spline';
window.chart.redraw();
}),
$.getJSON('http://www.highcharts.com/samples/data/jsonp.php?filename=aapl-c.json&callback=?', function(data) {
// Create the chart
window.chart = new Highcharts.StockChart({
chart: {
renderTo: 'container'
},
legend : {
floating : false,
width : 100,
verticalAlign : 'top',
enabled : true,
align : 'left',
layout : 'vertical',
padding : 20,
itemWidth : -1,
},
plotOptions : {
line : {
lineWidth : 1
},
series : {
showCheckbox : true,
events : {
legendItemClick : function(event) {
if (event.browserEvent.currentTarget.textContent == "Messages800") {
if (window.chart.series[0].visible) {
window.chart.series[0].hide();
} else {
window.chart.series[0].show();
}
}
}
}
}
},
rangeSelector: {
selected: 1
},
title: {
text: 'AAPL Stock Price'
},
series: [{
name: 'AAPL Stock Price',
data: data,
type: 'line',
tooltip: {
valueDecimals: 2
}
}]
});
});
});