((This post is about some tech things (JavaScript). Feel free to ignore it, otherwise read on.))I think I know where the bug lies. There's a bunch of JS building the data to be used by plotter. It works by taking original data and re-formatting it to the format used by the plotter. The original data looks more or less like this:
<ordinal number> 5 <ladder points count>; (...)
(note: I have no idea what this 5 does.)
To reformat this into the format used by plotter, there exists a JS function called BuildPoints. It looks like this:
function BuildPoints(d) {
var r = [];
var start = LadderHistoryData.StartDate().getTime();
var points = LadderHistoryData.Points().split(';');
for (var p in points) {
var s = points[p].split(' ');
var point = s[d] - 0;
if (point == 2000000000)
continue;
r.push([
new Date(s[0] * 24 * 60 * 60 * 1000 + start),
point]);
}
return r;
}
("d" is "i" in original code, but I had to change it for the formatting not to break. It can be either 1 or 2.)
If you know JavaScript, you should know that the for ... in construct iterates over object properties. In this case, the object is an array. However, something (I haven't found out what) adds a function property, called "remove", something like this lies somewhere:
Array.prototype.remove = function() {
var what,
a = arguments,
L = a.length,
ax;
while (L && this.length) {
what = a[--L];
while ((ax = this.indexOf(what)) !== -1) {
this.splice(ax, 1);
}
}
return this;
}
(note: this is a prettified version, created by Opera Dragonfly.)
The net result is, the for ... in construct iterates over the "remove" function, which obviously doesn't have the "split" function attached to it, resulting in a TypeError, breaking the entire graph.
The fix? It's simple: iterate only over the own properties of an array, using the hasOwnProperty function of an object. Something like this should suffice:
function BuildPoints(d) {
var r = [];
var start = LadderHistoryData.StartDate().getTime();
var points = LadderHistoryData.Points().split(';');
for (var p in points) {
if (points.hasOwnProperty(p)) {
var s = points[p].split(' ');
var point = s[d] - 0;
if (point == 2000000000)
continue;
r.push([
new Date(s[0] * 24 * 60 * 60 * 1000 + start),
point]);
}
}
return r;
}
Sources:
Regards,
Grzechooo