daily pastebin goal
13%
SHARE
TWEET

Untitled

a guest Jan 28th, 2016 41 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <!DOCTYPE HTML>
  2. <html>
  3. <head>
  4. <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  5. <title>Highcharts Example</title>
  6. <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js"></script>
  7. <script type="text/javascript">
  8. $(document).ready(function() {
  9.     var options = {
  10.         chart: {
  11.             renderTo: 'container',
  12.             type: 'column',
  13.             marginRight: 130,
  14.             marginBottom: 25
  15.         },
  16.         title: {
  17.             text: 'Project Requests',
  18.             x: -20 //center
  19.         },
  20.         subtitle: {
  21.             text: '',
  22.             x: -20
  23.         },
  24.         xAxis: {
  25.  //////////// FROM PHP data_2.php, $category
  26.             categories: []
  27.         },
  28.         yAxis: {
  29.             title: {
  30.                 text: 'Requests'
  31.             },
  32.             plotLines: [{
  33.                 value: 0,
  34.                 width: 1,
  35.                 color: '#808080'
  36.             }]
  37.         },
  38.         tooltip: {
  39.  
  40.         },
  41.         legend: {
  42.             layout: 'vertical',
  43.             align: 'right',
  44.             verticalAlign: 'top',
  45.             x: -10,
  46.             y: 100,
  47.             borderWidth: 0
  48.         },
  49.  //////////// FROM PHP data_2.php, $series1
  50.         series: []
  51.     }
  52.  
  53.  ///////////////HOW TO REPLACE JSON BY USING PHP ?//////////////////
  54.  /////$.getJSON("data_2.php", function(json) {
  55.  /////       options.xAxis.categories = json[0]['data'];
  56.  /////       options.series[0] = json[1];
  57.  /////       chart = new Highcharts.Chart(options);});
  58.  ///////////////////////////////////////////////////////////////////
  59.  
  60. });
  61. </script>
  62. </head>
  63.  
  64. <body>
  65. <script src="http://code.highcharts.com/highcharts.js"></script>
  66. <script src="http://code.highcharts.com/modules/exporting.js"></script>
  67. <div id="container" style="min-width: 400px; height: 400px; margin: 0 auto">     </div>
  68. </body>
  69.    
  70. <?php  
  71. header("Content-Type:application/json");
  72. include_once "shift.php";
  73.  
  74. list($s1,$e1,$shift) = shift_frame();
  75. $servername = 'localhost';
  76. $username = "";
  77. $password = "";
  78.  
  79. $select = "SELECT EH_CELLNUM, COUNT(EH_SERIALID)";
  80. $table = " FROM T_EEDATA";
  81. $rule1 = " WHERE (EH_END_DT between ".$s1." and ".$e1.") group by EH_CELLNUM";
  82. $conn = mysql_connect($servername,$username,$password) or die("Connection failed: " . mysqli_connect_error());
  83.  
  84. mysql_select_db("eedata",$conn) or die(mysql_error());
  85.  
  86. $sql = $select.$table.$rule1;
  87. $query = mysql_query( $sql, $conn );
  88.  
  89.  
  90. while($row = mysql_fetch_array($query)){
  91. $category['data'][] = $row['EH_CELLNUM'];
  92. $gantries =  $gantries.""".$row['EH_CELLNUM'].""".",";
  93. $series1['data'][] = $row['COUNT(EH_SERIALID)'];
  94. $insert =  $insert.$row['COUNT(EH_SERIALID)'].",";
  95. }
  96.  
  97. //for PHP < v5.2 to replace "json_numeric_check", manual adding up numbers      
  98. $gantries = rtrim($gantries, ",");
  99. $category = "[{"name":"Cellnum","data":[".$gantries."]}]";
  100. $insert = rtrim($insert, ",");
  101. $series1 = "[{"name":"SerialID","data":[".$insert."]}]";
  102.  
  103. //echo $category;
  104. //echo $series1;
  105.  
  106. mysql_close($conn);
  107.  
  108. ?>
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top