Javascript 如何使用php和mysql过滤highcharts中的日期

Javascript 如何使用php和mysql过滤highcharts中的日期,javascript,php,mysql,highcharts,Javascript,Php,Mysql,Highcharts,我有两个文件 1.Analytics.php 2.data_edgefactor.php 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(da

我有两个文件 1.Analytics.php 2.data_edgefactor.php

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">

函数show\u auth(auth\u id){
$.post(“analysis_table/show_table_ef.php”,{AUTHID_TEST_ef:“+auth_id+”),函数(data_ef){
如果(数据长度>0){
//////////////////////数据输出//////////////////////
document.getElementById('get_table_ef')。innerHTML=data_ef;
}
}); 
$.post(“analysis_table/data_edgefactor.php”,{AUTHID_TEST_EF:“+auth_id+”),函数(data_EF){
变量选项={
图表:{
renderTo:'容器\u边缘因子',
plotBackgroundColor:null,
plotBorderWidth:null,
plotShadow:false
},
xAxis:{
标题:{
正文:“年”
},
类别:[]
},
亚克斯:{
标题:{
正文:“引用次数”
},
绘图线:[{
值:0,
宽度:1,
颜色:'#808080'
}]
},
系列:[{
键入:“行”,
名称:“引文”,
数据:[]
}]
}
$.getJSON(“analysis_table/data_edgefactor.php”,{AUTHID_TEST_EF:auth_id},函数(data_EF){
options.series[0]。data=data\u ef;
图表=新的高点图表。图表(选项);
});
}); 
}
1988
1989
1990
及
1991
1992
1993
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);

?>

您可以在预处理过程中过滤数据,或使用setextrems定义轴上的自定义范围