簡體   English   中英

適用於Android的PhoneGap上的Jqplot錯誤

[英]Jqplot error on PhoneGap for Android

當嘗試在Android PhoneGap應用程序中使用jqplot時,出現以下錯誤:

Uncaught TypeError: Object function (a,b){return new e.fn.init(a,b,h)} has no method 'jqplot' at file:

該圖應該在按下按鈕后顯示。

我在Chrome的網頁上正確運行了完全相同的代碼,這表明該代碼是正確的。

下面的鏈接有同樣的問題,但是沒有人回答,所以我想我是否可以找到解決方法。

如何在Android手機版應用程序內繪制jqplot圖表

包括:

<script type="text/javascript" charset="utf-8" src="cordova-2.3.0.js"></script>
<link rel="stylesheet" href="jquery.mobile/jquery.mobile-1.2.0.min.css" />
<script type="text/javascript" src="jquery.mobile/jquery-1.8.0.min.js"></script>  
<script type="text/javascript" src="jquery.mobile/jquery.mobile-1.2.0.min.js"></script>     
<!--[if lt IE 9]><script type="text/javascript" src="excanvas.js"></script><![endif]-->
<script type="text/javascript" src="jqplot/jquery.jqplot.js"></script>
<link rel="stylesheet" type="text/css" href="jqplot/jquery.jqplot.css" />
<script type="text/javascript" src="jqplot/jqplot.canvasAxisLabelRenderer.min.js"></script>
<script type="text/javascript" src="jqplot/jqplot.canvasTextRenderer.js"></script>

jqplot代碼:

function makegraph() {
    $.jqplot('chartdiv',  [[[1, 2],[3,5.12],[5,13.1],[7,33.6],[9,85.9],[11,219.9]]]);
}

HTML:

<div id="chartdiv" style="height:400px;width:300px; "></div>

謝謝

找到了答案:

將data-ajax =“ false”放在href標記中以強制重新加載頁面,然后將加載jqplot腳本。

否則,將jqplot腳本和css文件放在data-role =“ page”標簽之后,並且腳本將在每次頁面轉換時加載。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM