最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

addeventlistener - websocket.onmessage - jqplot - No plot target specified - Stack Overflow

programmeradmin4浏览0评论

I'm building a real time IOT system over websocket. This is part of the code handling the new incomming data through devices-server-browser showing jqplot graph in infoWindow on google maps marker which is opening on each new data:

....

var infowindow = new google.maps.InfoWindow({ content: "<h1>Device1</h1>" });

google.maps.event.addListener(marker, 'click', function(t) {

   infowindow.open(map, marker);
   infowindow.setContent('<h3>Device1<img src="img/wait.gif"/></h3>');

   ws.addEventListener("message", newData);
   ws.send('{"getNewData":"Device1"}', { binary: false });

   function newData(message) {

      var content+='<div id="myPlot"></div>';
      infowindow.setContent(content); // executed till this part on error come up
      ...
      var graphParams = message.data; // [[1742367560000,4140],[1742369360000,4115]]
      setTimeout(function() { // even with this
         var plot=$.jqplot('myPlot', graphParams); // "No plot target specified"
      }, 150);

      ...
   }

});

The data comming in random intervals and sometime(after long random period each time) I'm getting "No plot target specified" error on specified line. Any ideas?

发布评论

评论列表(0)

  1. 暂无评论