I just start working with Highstock and may be don't understand all functionality.
But I detect that seriesProto.groupData (line 12823) function sometimes working too slow.
Here and later lines from highstock.src.js version 1.1.0.
I'm starting investigate why. Problem was detected in this loop (line 12843):
Code: Select all
// when a new group is entered, summarize and initiate the previous group
while ((groupPositions[1] !== UNDEFINED && xData[i] >= groupPositions[1]) ||
i === dataLength) { // get the last group
Code: Select all
xData[i] >= groupPositions[1]
But this is not interesting for me because I understand that I can change those loop and solve all problem
I changed code in line 12844 and from line 12863 to 12866
Two changes:
1. while => if
2. added groupPositions.splice functionality at the and of the loop
And now I have:
Code: Select all
[hilight]if[/hilight] ((groupPositions[1] !== UNDEFINED && xData[i] >= groupPositions[1]) ||
i === dataLength) { // get the last group
// get group x and y
pointX = groupPositions.shift();
groupedY = approximationFn(values1, values2, values3, values4);
// push the grouped data
if (groupedY !== UNDEFINED) {
groupedXData.push(pointX);
groupedYData.push(groupedY);
}
// reset the aggregate arrays
values1 = [];
values2 = [];
values3 = [];
values4 = [];
[hilight]var j = 1;
while (xData[i] > groupPositions[j]) j++;
groupPositions.splice (0, j);[/hilight]
}