Database data reading, reading data after the conversion of data format, and Highchart data source configuration, hurt the brain.
Anyway, finally opened. Ha ha!
Database connection:conn_orcale.php
<?php$dbconn=oci_connect ("Dnc-local", "dnc-local", "ORCL") or Die ("Database connection error");? >
Read data: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);? >
Or
<?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);? >
To generate a line chart using Highcharts: test.php
<?php require ' device_query.php ';? >php echo $data;? >}]</span>}); </script>
PHP echo $data. " \ n ";? ></p><div id= "mnmlist" style= "min-width:800px;height:400px" ></div></body>
Positive energy. There is a picture of the truth.
Use Highcharts to generate a line chart _at last