Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/477.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript uncaught typeerror undefined不是函数flotjs_Javascript_Plot_Flot_Typeerror - Fatal编程技术网

Javascript uncaught typeerror undefined不是函数flotjs

Javascript uncaught typeerror undefined不是函数flotjs,javascript,plot,flot,typeerror,Javascript,Plot,Flot,Typeerror,我一直在尝试使用实时绘图。外部数据来自arduino。我的问题是出现以下错误:未捕获类型错误未定义不是函数 var socket = io.connect('http://localhost:8000'); socket.on('pulse', function(data){ var datas = [], totalPoints = 300; function getData() {

我一直在尝试使用实时绘图。外部数据来自arduino。我的问题是出现以下错误:未捕获类型错误未定义不是函数

var socket = io.connect('http://localhost:8000');

      socket.on('pulse', function(data){
       
          var datas = [],
          totalPoints = 300;

        function getData() {

          if (datas.length > 0)
            datas = datas.slice(1);

          // Do a random walk

          while (datas.length < totalPoints) {

            datas.push(data);
          }

          // Zip the generated y values with the x values

          var res = [];
          for (var i = 0; i < datas.length; ++i) {
            res.push([i, datas[i]]);
          }

          return res;
        }

        var plot = $.plot("#placeholder", [ getData() ], {
          series: {
            shadowSize: 0 // Drawing is faster without shadows
          },
          yaxis: {
            min: 0,
            max: 100
          },
          xaxis: {
            show: false
          }
        });

        function update() {

          plot.setData([getData()]);

          // Since the axes don't change, we don't need to call plot.setupGrid()

          plot.draw();
          setTimeout(update, updateInterval);
        }

        update();
var socket=io.connect('http://localhost:8000');
socket.on('pulse',函数(数据){
var数据=[],
总积分=300;
函数getData(){
如果(datas.length>0)
数据=数据片(1);
//散散步
while(datas.length
此行出现错误:
var plot=$.plot(#占位符“,[getData()],{


问题是什么?

我解决了。它不只是提供静态文件。

发布最终解决方案;)