2013-09-23 118 views
0

濾波器highcharts日期我有兩個文件 1. Analytics.php 2. data_edgefactor.php如何使用PHP和MySQL

Analytics.php代碼

<script type="text/javascript"> 
    function show_auth(auth_id){ 
    $.post("analysis_table/show_table_ef.php", {AUTHID_TEST_EF: ""+auth_id+""}, function(data_ef){   

    if(data_ef.length > 0) { 
    //////////////////////DATA OUTPUT////////////////////// 

     document.getElementById('get_table_ef').innerHTML = data_ef; 
    } 

}); 

$.post("analysis_table/data_edgefactor.php", {AUTHID_TEST_EF: ""+auth_id+""}, function(data_ef){ 

     var options = { 
     chart: { 
       renderTo: 'container_edgefactor', 
       plotBackgroundColor: null, 
       plotBorderWidth: null, 
       plotShadow: false 
      }, 

      xAxis: { 
       title: { 
        text: 'Year' 
       }, 
       categories: [] 
       }, 

       yAxis: { 
        title: { 
         text: 'Number of Citations' 
        }, 
        plotLines: [{ 
         value: 0, 
         width: 1, 
         color: '#808080' 
        }] 
       }, 

      series: [{ 
       type: 'line', 
     name: 'Citations', 
       data: [] 
      }] 
     } 

     $.getJSON("analysis_table/data_edgefactor.php", {AUTHID_TEST_EF:auth_id}, function(data_ef) { 
     options.series[0].data = data_ef; 
      chart = new Highcharts.Chart(options); 
     }); 

}); 

    } 
</script> 


    <?php 
    echo '<a href="#" style="text-decoration:none; color: #000;" onClick="show_auth('.$id_auth.')">'.$get_auth.'</a>'; ?>                

<div id="container_edgefactor" style="width: 900px; height: 400px; "></div> 

<select name="from_year"> 
     <option value="1988">1988</option> 
     <option value="1989">1989</option> 
     <option value="1990">1990</option> 
</select> 
     and 
<select name="to_year"> 
     <option value="1991">1991</option> 
     <option value="1992">1992</option> 
     <option value="1993">1993</option> 
</select> 

    <input id="fixsubmit" type="submit" name="update_citations" value="Update Graph"> 

2.data_edgefactor.php代碼

<?php 

    include '../connect.php'; 

    $get = $_REQUEST['AUTHID_TEST_EF']; 
    $result_citations = mysql_query("SELECT year, citations, auth_id FROM subj_area WHERE auth_id='$get'"); 
$rows_citations = array(); 
    while($r_citations = mysql_fetch_array($result_citations)) { 
$row_citations[0] = $r_citations[0]; 
$row_citations[1] = $r_citations[1]; 
array_push($rows_citations,$row_citations); 
    } 

print json_encode($rows_citations, JSON_NUMERIC_CHECK); 

?> 

這裏一切正常,該圖是根據的onclick功能的用戶展示,但我需要過濾的一年,顯示根據用戶圖形選擇年份。

如何做到這一點。請幫忙。

回答