Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/flash/4.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
Jquery flot.js:无法读取属性';p2c';在Plot.Plot.pointOffset处的未定义值_Jquery_Flot - Fatal编程技术网

Jquery flot.js:无法读取属性';p2c';在Plot.Plot.pointOffset处的未定义值

Jquery flot.js:无法读取属性';p2c';在Plot.Plot.pointOffset处的未定义值,jquery,flot,Jquery,Flot,使用flot.js v 0.83时,从.pointOffset获取数据时遇到问题。 这是我的代码: var position = 0; var existing = $("#placeholder"+tnr).data("plot"); var leftoffset = existing.offset(); // i receive values for offset! var lastDatapoint; $.each(existing.getData(), function(i, item,

使用flot.js v 0.83时,从.pointOffset获取数据时遇到问题。 这是我的代码:

var position = 0;
var existing = $("#placeholder"+tnr).data("plot");
var leftoffset = existing.offset();
// i receive values for offset!
var lastDatapoint;
$.each(existing.getData(), function(i, item, array) {
            // get the last data point in the series data, e.g. [0, 5]
            lastDatapoint = item.data[item.data.length - 1]; // still receive data here!
            // get the position of the datapoint fails!!!
            position = existing.pointOffset({
              x: lastDatapoint[0],
              y: lastDatapoint[1]
            });
        });
实际上,我接收existing.offset甚至lastDatapoint的值。但在请求pointOffset时,我得到以下错误:

未捕获的TypeError:无法读取未定义的属性“p2c” 在Plot.Plot.pointOffset处(jquery.flot.min.js:7)


这里怎么了?

好吧,对我来说,问题已经解决了。由于我需要绘图的左侧位置和宽度,为了对齐下面的另一个画布,我现在将这样做:

var existing = $("#placeholder"+tnr).data("plot");
// get the left margin
var offset = existing.offset();
var left = offset['left'];
// get width of 'real' plot
var width = existing.width();

好吧,对我来说,问题解决了。由于我需要绘图的左侧位置和宽度,为了对齐下面的另一个画布,我现在将这样做:

var existing = $("#placeholder"+tnr).data("plot");
// get the left margin
var offset = existing.offset();
var left = offset['left'];
// get width of 'real' plot
var width = existing.width();

请显示其余代码,特别是Flot图表的轴选项。
pointOffset()
函数与正常选项一起工作:@Raidri将绘图分配到变量时,您的日志是正确的,就像在小提琴
var plot=
中一样。我不能这样做,因为我动态加载多个绘图。这就是为什么我这样请求绘图:
var existing=$(“#占位符”+tnr).data(“绘图”)未使用
var绘图=…
,这不是问题或区别。请显示其余代码,特别是Flot图表的轴选项。
pointOffset()
函数与正常选项一起工作:@Raidri将绘图分配到变量时,您的日志是正确的,就像在小提琴
var plot=
中一样。我不能这样做,因为我动态加载多个绘图。这就是为什么我这样请求绘图:
var existing=$(“#占位符”+tnr).data(“绘图”)未使用
var绘图=…
,这不是问题或区别。