Altere o intervalo no Highstock dinamicamente
Eu quero mudar o intervalo em um gráfico dinamicamente. Se eu for de um grande valor para um menor, tudo funciona bem. Mas se eu quiser ir para o maior novamente, nada acontece.
Você pode tentar isso aqui:http://jsfiddle.net/Charissima/wkBwW/15/
Clique no botão 'Intervalo 50' e depois no 'Alcance 20'. Então 'Gama 50' novamente. Você pode ver a cor mudar, mas não o intervalo.
Eu tentei muito descobrir como consertar esse problema, mas sem sucesso. Espero que alguém possa me ajudar.
<div id="container" style="height: 400px; min-width: 600px"></div>
<script src="http://code.highcharts.com/stock/highstock.js"></script>
<button id="button_20">Range 20</button>
<button id="button_50">Range 50</button>
$(function() {
$('#container').highcharts({
chart: {
},
rangeSelector: {
enabled: false
},
exporting: {
enabled: false
},
title : {
text : 'Ranges'
},
navigator: {
enabled: true,
},
xAxis: {
lineColor: '#ffcc00'
},
series : [{
name : 'Random data',
data : (function() {
// generate an array of random data
var data = [], i;
for( i = 1; i <= 100; i++) {
data.push([
i,
Math.round(Math.random() * 100)
]);
}
return data;
})()
}]
});
// the button action
$('#button_20').click(function() {
var chart = $('#container').highcharts();
chart.xAxis[0].update({
lineColor: '#00ff00',
range: 20
});
});
$('#button_50').click(function() {
var chart = $('#container').highcharts();
chart.xAxis[0].update({
lineColor: '#E22636',
range: 50
});
});
});