如何使Android设备上线图? [英] How i make line graph on android device?

查看:174
本文介绍了如何使Android设备上线图?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用的钛SDK。我想在我的应用程序添加线图设施。
我的应用程序是既兼容设备(Android和iPhone)。折线图我使用谷歌图形API。 ( https://developers.google.com/chart/interactive/docs/gallery/线型图)。但正在与只不与Android的iPhone。
与iPhone合作非常好。
但是,不与Android合作。
错误消息是:[出pression的结果'C [0] - [空]不是一个对象。 ]
我如何删除此问题
我用这code。

I am using Titanium SDK. and I want to add line graph facility in my app. my app is both device compatible (android and iphone). for line chart i am using google graph api. (https://developers.google.com/chart/interactive/docs/gallery/linechart). but is working with only iphone not with android. with iphone working very good. but, not working with android. error message is : [Result of expression 'c[0]'[null] is not an object. ] how i remove this issues I am using this code.

<html>
  <head>
    <script type="text/javascript" src="https://www.google.com/jsapi"></script>
    <script type="text/javascript">
      google.load("visualization", "1", {packages:["corechart"]});
      google.setOnLoadCallback(drawChart);
      function drawChart() {

            var data = new google.visualization.DataTable();
            data.addColumn('string', 'Month'); // Implicit domain label col.
            data.addColumn('number', 'Sales'); // Implicit series 1 data col.
            data.addColumn({type:'string', role:'annotation'}); // annotation role col.
            data.addRows([
                ['April',1000,    'A'],
                ['May',  1170,   'B'],
                ['June',  660,   'C'],
                ['July', 1030,  'c']
            ]);
            var options = {
              title: 'Company Performance'
            };

            var chart = new google.visualization.LineChart(document.getElementById('chart_div'));
            chart.draw(data, options);
      }
    </script>
  </head>
  <body>
    <div id="chart_div" style="width: 900px; height: 500px;"></div>
  </body>
</html>

请帮助我,在此先感谢

推荐答案

这code正在为我的身边。

This code is working for my side.

<html>
  <head>
    <script type="text/javascript" src="https://www.google.com/jsapi"></script>
    <script type="text/javascript">
      google.load("visualization", "1", {packages:["corechart"]});
      google.setOnLoadCallback(drawChart);
      function drawChart() {
        var data = google.visualization.arrayToDataTable([
          ['Year', 'Sales', 'Expenses'],
          ['2004',  1000,      400],
          ['2005',  1170,      460],
          ['2006',  660,       1120],
          ['2007',  1030,      540]
        ]);

        var options = {
                width: 400, height: 400, annotationColumns:[{column:2, size:15, type:'flag', priority:'high'},], title: ''
        };

        var chart = new google.visualization.LineChart(document.getElementById('chart_div'));
        chart.draw(data, options);
      }
    </script>
  </head>
  <body>
    <div id="chart_div" style="width: 900px; height: 500px;"></div>
  </body>
</html>

感谢所有。

这篇关于如何使Android设备上线图?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆