joola / joola.sdk

Joola's Software Development Kit (SDK)
https://joo.la
Other
3 stars 3 forks source link

Bug when drawing Sparkline #60

Closed itayw closed 10 years ago

itayw commented 10 years ago

Related to joola/joola.io#368.

Uncaught TypeError: Cannot read property '0' of undefined 

(anonymous function) joola.io.js?APIToken=apitoken-reader:5341
(anonymous function) joola.io.js?APIToken=apitoken-reader:5339
(anonymous function) joola.io.js?APIToken=apitoken-reader:5338
(anonymous function) joola.io.js?APIToken=apitoken-reader:5561
(anonymous function) joola.io.js?APIToken=apitoken-reader:1947
(anonymous function) joola.io.js?APIToken=apitoken-reader:1733
call joola.io.js?APIToken=apitoken-reader:1843
EventEmitter.emit joola.io.js?APIToken=apitoken-reader:16868
SocketNamespace.onPacket joola.io.js?APIToken=apitoken-reader:18412
Socket.onPacket joola.io.js?APIToken=apitoken-reader:18102
Transport.onPacket joola.io.js?APIToken=apitoken-reader:17550
Transport.onData joola.io.js?APIToken=apitoken-reader:17527
websocket.onmessage joola.io.js?APIToken=apitoken-reader:18542
else if (self.options.query.realtime) {
        //we're dealing with realtime
        series.forEach(function (ser, serIndex) {
          ser.data.forEach(function (datapoint) {
            var found = false;
            --> self.chart.series[serIndex].points.forEach(function (point) {
              if (point) {
                if (point.x.getTime() == datapoint.x.getTime()) {
                  var y = self.chart.series[serIndex].data[self.chart.series[serIndex].data.length - 1].y;
                  found = true;
                  if (y != datapoint.y)
                    self.chart.series[serIndex].data[self.chart.series[serIndex].data.length - 1].update(datapoint.y);
                }
              }
            });
            if (!found) {
              self.chart.series[serIndex].addPoint({x: datapoint.x, y: datapoint.y}, true, true);
            }
          });
        });
      }