JSFiddle - React, Tailwind, and code Playground
by minagabriel
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>
<button id="button">Get Y axis extremes</button>
<div id="report"></div>
JavaScript
$(function() {
$.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' ,
zoomType : 'x'
},
rangeSelector : {
selected : 1
},
title : {
text : 'AAPL Stock Price'
},
xAxis :{
events :{
setExtremes :function(){
}
}
} ,
series : [{
name : 'AAPL',
data : data,
tooltip: {
valueDecimals: 2
}
}]
},function(chart) {
});
});
$('#button').click(function() {
var extremes = chart.xAxis[0].getExtremes()
$('#report').html(
'max: '+ Highcharts.dateFormat('%e. %b %Y, %H:00',extremes.max) +'<br/>'+
'min: '+ Highcharts.dateFormat('%e. %b %Y, %H:00',extremes.min )+'<br/>'
) ;
});
});