zabbix-d3js-widgets icon indicating copy to clipboard operation
zabbix-d3js-widgets copied to clipboard

itemGauges and timeSeries do not work in samples.html

Open B5r1oJ0A9G opened this issue 9 years ago • 1 comments

TypeError: items[startIndex] is undefined

--- SNIP d3zabbix.js ---
function getIndex(items, value) {
    var startIndex  = 0,
        stopIndex   = items.length - 1,
        middle      = Math.floor((stopIndex + startIndex)/2),
        floor       = -1,
        ceil        = -1;

/// Here the issue hapens \/
    if (value <= items[startIndex][0]) return [ -1, 0, 0 ];
/// Here the issue hapens /\

    if (value >= items[stopIndex][0]) return [ stopIndex, -1, stopIndex ];
    while (items[middle][0] != value && startIndex < stopIndex) {
        if (value < items[middle][0]) {
            stopIndex = middle - 1;
            ceil = middle;
        } else if (value > items[middle][0]) {
            startIndex = middle + 1;
            floor = middle;
        }
        middle = Math.floor((stopIndex + startIndex)/2);
    }

--- SNAP d3zabbix.js ---

B5r1oJ0A9G avatar Apr 02 '15 11:04 B5r1oJ0A9G