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

标签 javascript html ios css jqplot

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

使用的html代码如下:

Devicepiechart.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文件的代码都下载下来并包含在元素内部,devicepiechart.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 和浏览器中创建饼图。提前致谢。

最佳答案

只需将所有 .js 文件加载到元素目标“构建阶段”的“复制捆绑资源”中,现在饼图在 ios 模拟器中成功运行。

关于javascript - 使用带有 html css 和 js 的 jqplot 在 ios xcode 上创建饼图的问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20472913/

相关文章:

javascript - 将文字动态拉伸(stretch)到任意屏幕高度

ios - 将对象添加到 NSMutableArray 时 Objective-c 程序崩溃

ios - 如何在框架中使用 SwiftUI

ios - EAAccessoryManager showBluetoothAccessoryPicker 本地化

javascript - React 子组件不会在状态更改时重新渲染

javascript - CKEditor 调用 openDialog 我淡出但没有对话框

javascript - jQuery - 检查元素是否出现在 View 中,淡入那些出现的元素

javascript - 将平面对象数组转换为嵌套对象数组

javascript - Angular v2.4.7 [innerHtml] 和 [ngStyle] 在同一元素上

html - 为什么嵌套在 css 类选择器中不能按预期工作