MaM*_*aMu 9 jquery jquery-plugins jqplot
我正在尝试使用以下代码绘制jqplot:
<script lang="javascript" type="text/javascript">
$(document).ready(function () {
var line1 = var line1 =[["10.01.2011",3.9990],["11.01.2011",3.9910],["12.01.2011",4.0140],["13.01.2011",3.9940],["14.01.2011",3.9050],["17.01.2011",3.9340],["18.01.2011",3.9520],["19.01.2011",3.8980],["20.01.2011",3.8690],["21.01.2011",3.8830],["24.01.2011",3.8550],["25.01.2011",3.8480],["26.01.2011",3.8190],["27.01.2011",3.8440],["28.01.2011",3.8260],["31.01.2011",3.8060],["01.02.2011",3.7970],["02.02.2011",3.8060],["03.02.2011",3.8110],["04.02.2011",3.8640],["07.02.2011",3.8750],["08.02.2011",3.8640],["09.02.2011",3.8480],["11.02.2011",3.8570],["14.02.2011",3.8880],["15.02.2011",3.88],["16.02.2011",3.8520],["17.02.2011",3.8590],["18.02.2011",3.8690],["22.02.2011",3.8440],["23.02.2011",3.8080],["24.02.2011",3.7410],["25.02.2011",3.7460],["28.02.2011",3.7550],["01.03.2011",3.7520],["02.03.2011",3.76],["03.03.2011",3.7420],["04.03.2011",3.7430],["07.03.2011",3.7330],["08.03.2011",3.7260],["09.03.2011",3.76],["10.03.2011",3.7910],["11.03.2011",3.79]];
var plot1 = $.jqplot('chart1', [line1], {
title: 'Default Date Axis',
axes: { xaxis: { renderer: $.jqplot.DateAxisRenderer } },
series: [{ lineWidth: 4, markerOptions: { style: 'square' } }]
});
});
</script>
Run Code Online (Sandbox Code Playgroud)
它是通过一些C#代码生成的,但最后页面源看起来像呈现的代码.未绘制图表,jquery抛出此异常:No plot target specified
.
有什么线索吗?
nic*_*k_w 15
确保你的HTML包含一个ID为1的元素(通常是div)chart1
.
jqplot源代码如下:
this.init = function(target, data, options) {
this.target = $('#'+target);
....
if (!this.target.get(0)) {
throw "No plot target specified";
}
....
}
Run Code Online (Sandbox Code Playgroud)
它似乎是代码中唯一发生特定错误的地方.请注意,该#
字符前置于target
,因此为什么目标需要是有效的Id.
归档时间: |
|
查看次数: |
13918 次 |
最近记录: |