Jquery jqplot.canvasAxis渲染器抛出未捕获的类型错误
我正在使用jqplot显示我的bar char 在我添加tickRenderer和tickOptions之前,条形图运行良好 现在我得到以下错误:uncaughttypeerror:undefined不是函数 这是我的密码Jquery jqplot.canvasAxis渲染器抛出未捕获的类型错误,jquery,jqplot,Jquery,Jqplot,我正在使用jqplot显示我的bar char 在我添加tickRenderer和tickOptions之前,条形图运行良好 现在我得到以下错误:uncaughttypeerror:undefined不是函数 这是我的密码 plot3 = $.jqplot('chart3', [s2, s3], { stackSeries: true, seriesDefaults: { renderer: $.jqplot.BarRenderer, render
plot3 = $.jqplot('chart3', [s2, s3], {
stackSeries: true,
seriesDefaults: {
renderer: $.jqplot.BarRenderer,
rendererOptions: {
highlightMouseDown: true
},
pointLabels: {show: true}
},
legend: {
show: true,
location: 'e',
placement: 'outside'
},
axes: {
xaxis: {
renderer: $.jqplot.CategoryAxisRenderer,
ticks: ticks,
tickRenderer: $.jqplot.CanvasAxisTickRenderer ,
tickOptions: {
angle: -90,
fontSize: '10pt'
}
}
}
});
我试过你的代码,它工作。。。 我不知道你有什么问题 我包括了这些插件
<script src="http://code.jquery.com/jquery-1.9.1.min.js"></script>
<script type="text/javascript" src="http://cdn.jsdelivr.net/jqplot/1.0.8/jquery.jqplot.min.js"></script>
<link rel="stylesheet" type="text/css" href="http://cdn.jsdelivr.net/jqplot/1.0.8/jquery.jqplot.min.css" />
<script type="text/javascript" src="http://cdn.jsdelivr.net/jqplot/1.0.8/plugins/jqplot.barRenderer.min.js"></script>
<script type="text/javascript" src="http://cdn.jsdelivr.net/jqplot/1.0.8/plugins/jqplot.categoryAxisRenderer.min.js"></script>
<script type="text/javascript" src="http://cdn.jsdelivr.net/jqplot/1.0.8/plugins/jqplot.pointLabels.min.js"></script>
<script type="text/javascript" src="http://cdn.jsdelivr.net/jqplot/1.0.8/plugins/jqplot.cursor.min.js"></script>
这就是结果
我在动态加载脚本,但我的loadScript()函数是asyc函数,因此在绘制图表之前,并非所有资源都已加载。将async更改为false后,一切都开始工作
loadScript("jqplot/jquery.jqplot.min.js");
loadScript("jqplot/jqplot.dateAxisRenderer.min.js");
loadScript("jqplot/jqplot.barRenderer.min.js");
loadScript("jqplot/jqplot.canvasTextRenderer.min.js");
loadScript("jqplot/jqplot.canvasAxisTickRenderer.min.js");
loadScript("jqplot/jqplot.categoryAxisRenderer.min.js");
loadScript("jqplot/jqplot.pointLabels.min.js");
function loadScript(jsPage) {
$.ajax({
url: jsPage,
async: false,
dataType: "script"
});
}
loadScript("jqplot/jquery.jqplot.min.js");
loadScript("jqplot/jqplot.dateAxisRenderer.min.js");
loadScript("jqplot/jqplot.barRenderer.min.js");
loadScript("jqplot/jqplot.canvasTextRenderer.min.js");
loadScript("jqplot/jqplot.canvasAxisTickRenderer.min.js");
loadScript("jqplot/jqplot.categoryAxisRenderer.min.js");
loadScript("jqplot/jqplot.pointLabels.min.js");
function loadScript(jsPage) {
$.ajax({
url: jsPage,
async: false,
dataType: "script"
});
}