|
@ -781,17 +781,17 @@ LineGraph.prototype._getRelevantData = function (groupIds, groupsData, minDate, |
|
|
var itemsData = group.getItems(); |
|
|
var itemsData = group.getItems(); |
|
|
// optimization for sorted data
|
|
|
// optimization for sorted data
|
|
|
if (group.options.sort == true) { |
|
|
if (group.options.sort == true) { |
|
|
var max = maxDate.getTime(); |
|
|
|
|
|
var guess = Math.max(0, util.binarySearchValue(itemsData, minDate, 'x', 'before')); |
|
|
|
|
|
var dataContainer = new Array(itemsData.length-guess); |
|
|
|
|
|
for (j = guess; j < itemsData.length; j++) { |
|
|
|
|
|
|
|
|
var first = Math.max(0, util.binarySearchValue(itemsData, minDate, 'x', 'before')); |
|
|
|
|
|
var last = Math.min(itemsData.length, util.binarySearchValue(itemsData, maxDate, 'x', 'after')); |
|
|
|
|
|
if (last < 0) { |
|
|
|
|
|
last = itemsData.length; |
|
|
|
|
|
} |
|
|
|
|
|
var dataContainer = new Array(last-first); |
|
|
|
|
|
for (j = first; j < last; j++) { |
|
|
item = group.itemsData[j]; |
|
|
item = group.itemsData[j]; |
|
|
dataContainer[j-guess] = item; |
|
|
|
|
|
if (item.x.getTime() > max) { |
|
|
|
|
|
groupsData[groupIds[i]] = dataContainer.splice(0,j-guess); |
|
|
|
|
|
break; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
dataContainer[j-first] = item; |
|
|
} |
|
|
} |
|
|
|
|
|
groupsData[groupIds[i]] = dataContainer; |
|
|
} |
|
|
} |
|
|
else { |
|
|
else { |
|
|
// If unsorted data, all data is relevant, just returning entire structure
|
|
|
// If unsorted data, all data is relevant, just returning entire structure
|
|
|