我想用jqplot與jquery mobile,牽線木偶和requirejs。我已經囊括了所有jqplot需要CSS,以及在head標籤的腳本文件,但是當我嘗試使用下面的代碼試圖使用jqplot與jquery mobile,牽線木偶和requirejs
define([ 'jquery', 'plot' ],
function($) {
console.log("Success..Inside Offer Page Script.");
console.log("Plot..."+$.jqplot);
console.log("jquery..."+$);
$.jqplot.config.enablePlugins = true;
var s1 = [ 2, 6, 7, 10 ];
var ticks = [ 'a', 'b', 'c', 'd' ];
plot1 = $.jqplot('chart1', [ s1 ], {
seriesDefaults : {
renderer : $.jqplot.BarRenderer,
pointLabels : {
show : true
}
},
axes : {
xaxis : {
renderer : $.jqplot.CategoryAxisRenderer,
ticks : ticks
}
},
highlighter : {
show : false
}
});
});
繪製圖表它給了我這樣的錯誤
Uncaught TypeError: undefined is not a function jqplot.barRenderer.js:41
(line 41: $.jqplot.BarRenderer.prototype = new $.jqplot.LineRenderer();)
Uncaught TypeError: Cannot call method 'push' of undefined jqplot.pointLabels.js:377
(line 377: $.jqplot.postSeriesInitHooks.push($.jqplot.PointLabels.init);)
中的情節我上面的代碼的定義是
define([
'../scripts/ext_libs/jquery.jqplot'
],
function() {
var plot;
require([
'../scripts/ext_libs/jqplot.barRenderer',
'../scripts/ext_libs/jqplot.pointLabels',
'../scripts/ext_libs/jqplot.categoryAxisRenderer',
],
function() {
plot = $.jqplot;
});
return plot;
});
任何人都可以請幫助我如何解決這些錯誤。他們使用jqplot和requirejs的問題?
在此先感謝。
任何人都可以請別人幫我解決這個問題。請。 – Rachna