하이차트 yAxis change method
하이차트 그래프 생성 후 y축의 max, min value 변경
<script src="https://code.jquery.com/jquery-3.1.1.min.js"></script>
<script src="https://code.highcharts.com/highcharts.js"></script>
<script src="https://code.highcharts.com/modules/exporting.js"></script>
<div id="container" style="height: 400px"></div>
<button id="button" class="autocompare">y축 크게</button>
<button id="button1" class="autocompare">y축 작게</button>
<script>
var chart = Highcharts.chart('container', {
endOnTick:false,
startOnTick:false,
series: [{
data: [29.9, 71.5, 106.4, 129.2, 144.0, 176.0, 135.6, 148.5, 216.4, 194.1, 95.6, 54.4]
}]
});
// the button action
$('#button').click(function() {
var max = chart.yAxis[0].max;
var min = chart.yAxis[0].min;
max+=10;
chart.yAxis[0].setExtremes(min,max);
});
$('#button1').click(function() {
var max = chart.yAxis[0].max;
var min = chart.yAxis[0].min;
min-=10;
chart.yAxis[0].setExtremes(min,max);
});
</script>