简体   繁体   中英

HighCharts navigator and range scale not working?

need some help. How can i limit min and max values from json array with js.

This is my problem, working on highstocks and my date is first day in unix but in array i have correct date. So my navigator and range scale is't working?

My json array is in variable

var data = <?php echo $data; ?>;

but i want to limit it like this

$.getJSON('https://www.highcharts.com/samples/data/from-sql.php?start=' + Math.round(e.min) +
                '&end=' + Math.round(e.max) + '&callback=?', function (data)

This is my json structure

[1233014400000,12.96],  
[1233100800000,13.46],  
[1233187200000,13.29],  
[1233273600000,12.88],

$(function () {

var data = <?php echo $data; ?>; // geting json array [1233014400000,12.96] //

// Create the chart
$('#container_small').highcharts('StockChart', {

    rangeSelector : {
        selected : 1,
        enabled: true
    },

    title : {
        text : 'Tankerska Next Generation d.d.'
    },

    navigator : {
        enabled: true
    },

    series : [{
        name : 'Tankerska Next Generation d.d.',
        data : data,
        marker : {
            enabled : true,
            radius : 4
        },
        shadow : true,
        tooltip : {
            valueDecimals : 2
        }
    }]
});

});

Thank you for help

function getMaxOfArray(numArray) {
  return Math.max.apply(null, numArray);
}

And the same goes with the minimum value.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM