使用jqplot和html css和js在ios xcode上创建饼图的问题

Issue with Piechart creation on ios xcode using jqplot with html css and js

本文关键字:创建 问题 xcode ios html jqplot css js 使用      更新时间:2024-05-24

我正试图使用jqplot库以及HTML、JS和CSS在我的ios xcode中创建一个piechart。在xcode模拟器中,我无法获得任何输出——只有主HTML页面的警报正在显示。在chrome borwser中运行html文件时,没有得到结果,但可以得到html文件和所有其他javascript文件的所有警报。

使用的html代码如下:

Devicepiechat.html:

<!DOCTYPE html>
<html lang="en">
<Head>
    <title>Testing plots functions</title>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
      <link rel="stylesheet" type="text/css" href="jquery.jqplot.css" />
           <!-- BEGIN: load jquery -->
     <script language="javascript" type="text/javascript" src="jquery-2.0.3.min.js"></script>
        <script>
            function load()
            {alert("loading HTML scripts!");}

        </script>
        <script language="javascript" type="text/javascript" src="jquery.jqplot.min.js"></script>
        <script language="javascript" type="text/javascript" src="jqplot.pieRenderer.min.js"></script>
        <!-- END: load jqplot -->
        </head>
   <body onload= "load()">
    <div id="pie" style="margin-top:-15px; margin-left:-15px; width:335px; height:445px;"> </div> </body> </html>

其他css和js文件的代码被下载并包含在项目中,devicepiecht.js文件如下:

 $(document).ready(function(){
var data = [
['Heavy Industry', 12],['Retail', 9], ['Light Industry', 14], 
['Out of home', 16],['Commuting', 7], ['Orientation', 9]
];
var plot1 = jQuery.jqplot ('chart1', [data], 
{ 
  seriesDefaults: {
    // Make this a pie chart.
    renderer: jQuery.jqplot.PieRenderer, 
    rendererOptions: {
      // Put data labels on the pie slices.
      // By default, labels show the percentage of the slice.
      showDataLabels: true
    }
  }, 
  legend: { show:true, location: 'e' }
  }
 );
 });

所有其他的js和css文件都包含在同一个文件夹中。有人能帮我在xcode和浏览器中创建piechart吗。提前谢谢。

只需将所有.js文件加载到项目Targets的"buildid phases"的"copy bundle resources"中,现在piechat就可以在ios模拟器中成功运行了。