使用Highcharts產生折線圖_at last,highcharts_at

來源:互聯網
上載者:User

使用Highcharts產生折線圖_at last,highcharts_at

//資料庫資料的讀取,讀取資料後資料格式的轉換,還有highchart資料來源的配置,傷透了腦筋。anyway,終於開張了,哈哈!

資料庫連接:conn_orcale.php

<?php$dbconn=oci_connect("dnc-local","dnc-local","orcl")or die("資料庫連接錯誤");?>
讀取資料:device_query.php

<?php  require 'conn_orcale.php';  $sql = "select * from xiaolv_month";  $query = oci_parse($dbconn,$sql);  oci_execute($query);   <span style="color:#ff0000;">while( $a = oci_fetch_array($query))   {      $b[] = intval($a[1]);     }    $data= json_encode($b);</span>     oci_close($dbconn);?>
或

<?php  require 'conn_orcale.php';  $sql = "select month,xiaolv from xiaolv_month";  $query = oci_parse($dbconn,$sql);  <span style="color:#ff0000;">$b=array();   while( $a = oci_fetch_array($query))   {   array_push($b,intval($a[1]));   }    echo json_encode($b);</span>     oci_close($dbconn);?>
使用Highcharts產生折線圖:Test.php
<?php  require 'device_query.php';?><html><head><title>hello mnmlist!</title><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><script type="text/javascript" src="js/jquery.min.js"></script><script type="text/javascript" src="js/highcharts.js"></script><script type="text/javascript" src="js/themes/gray.js"></script><script type="text/javascript" src="js/json_parse.js"></script><script type="text/javascript">$(function () {    $('#mnmlist').highcharts({        title: {            text: 'Monthly Average Temperature',            x: -20 //center        },        subtitle: {            text: 'Source: WorldClimate.com',            x: -20        },        xAxis: {            categories: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun','Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']        },        yAxis: {            title: {                text: 'Temperature (°C)'            },            plotLines: [{                value: 0,                width: 1,                color: '#808080'            }]        },        tooltip: {            valueSuffix: '°C'        },        legend: {            layout: 'vertical',            align: 'right',            verticalAlign: 'middle',            borderWidth: 0        },        <span style="color:#ff0000;">series: [{            name: 'xiaolv',            data: <?php echo $data;?>        }]</span>    });});</script></head><body><p><?php echo $data."\n";?></p><div id="mnmlist" style="min-width:800px;height:400px"></div></body></html>

正能量,有圖有真相。






highcharts折線圖有多條線,怎使它初始化只畫一條線?

1、有多條線,只顯示一條,其他的暫時不顯示,執行個體代碼如下

2、只繪製一條線,其他線條後來用函數繪製
增加線條的函數是:addSeries(),詳細請看API文檔


 
在AspNet中怎寫查詢資料並綁定在Highcharts(折線圖)上 案例代碼

為什麼不用微軟的MSCHAT呢?MSCHAT支援多種資料來源以及多種展示方式呢。
 

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.