|
|
@ -455,20 +455,35 @@ LineGraph.prototype._updateAllGroupData = function () { |
|
|
|
if (this.itemsData != null) { |
|
|
|
var groupsContent = {}; |
|
|
|
var items = this.itemsData.get(); |
|
|
|
//pre-Determine array sizes, for more efficient memory claim
|
|
|
|
var groupCounts = {}; |
|
|
|
for (var i = 0; i < items.length; i++) { |
|
|
|
var item = items[i]; |
|
|
|
var groupId = item.group; |
|
|
|
if (groupId === null || groupId === undefined) { |
|
|
|
groupId = UNGROUPED; |
|
|
|
} |
|
|
|
if (groupsContent[groupId] === undefined) { |
|
|
|
groupsContent[groupId] = []; |
|
|
|
groupCounts.hasOwnProperty(groupId) ? groupCounts[groupId]++ : groupCounts[groupId] = 1; |
|
|
|
} |
|
|
|
//Now insert data into the arrays.
|
|
|
|
for (var i = 0; i < items.length; i++) { |
|
|
|
var item = items[i]; |
|
|
|
var groupId = item.group; |
|
|
|
if (groupId === null || groupId === undefined) { |
|
|
|
groupId = UNGROUPED; |
|
|
|
} |
|
|
|
if (!groupsContent.hasOwnProperty(groupId)) { |
|
|
|
groupsContent[groupId] = new Array(groupCounts[groupId]); |
|
|
|
} |
|
|
|
//Copy data (because of unmodifiable DataView input.
|
|
|
|
var extended = util.bridgeObject(item); |
|
|
|
extended.x = util.convert(item.x, 'Date'); |
|
|
|
extended.orginalY = item.y; //real Y
|
|
|
|
extended.y = item.y; |
|
|
|
groupsContent[groupId].push(extended); |
|
|
|
// typecast all items to numbers. Takes around 10ms for 500.000 items
|
|
|
|
extended.y = Number(item.y); |
|
|
|
|
|
|
|
var index= groupsContent[groupId].length - groupCounts[groupId]--; |
|
|
|
groupsContent[groupId][index] = extended; |
|
|
|
} |
|
|
|
//Update legendas, style and axis
|
|
|
|
for (var groupId in groupsContent) { |
|
|
|