<script type="text/javascript">
$(document).ready(function (){
var options = {
chart: {
renderTo: 'container',
defaultSeriesType: 'spline', //圖表類型 line, spline, area, areaspline, column, bar, pie , column,scatter
inverted: false //左右顯示,預設上下正向。假如設定為true,則橫縱座標調換位置
},
xAxis: {
categories:[],
title: {text: '時間'} //x軸座標標題 labels:縱柱尺規
},
yAxis: {
title: {text: '點擊量'}, //Y軸座標標題 labels:縱柱尺規
min:0
},
tooltip: {
formatter: function() {
//當滑鼠懸置資料點時的格式化提示
return '總人數:' + Highcharts.numberFormat(this.y, 1)+'人<br/>目前時間:'+ this.x ;
}
},
credits: {
enabled: false
},
plotOptions: {
column: {
pointPadding: 0.2, //圖表柱形的
borderWidth: 0 //圖表柱形的粗細
},bar: {
dataLabels: {
enabled: false
}
}
},
title: { text: '指定時間點擊量統計圖'}, //圖表主標題
series:[]
};
$("#btn").click(function(){
$.post("/tgSpreadServlet",{page:"dayget",sdate:$("#sdate").val(),edate:$("#edate").val(),surl:$("#sUrl").val()},function(data){
var sd=$("#sdate").val();
var ed=$("#edate").val();
//計算相差天數
var datediff=DateDiff(sd, ed);
for(var i=0;i<datediff;i++){
var s=AddDays(sd,i);
options.xAxis.categories.push(s);
}
data=eval("("+data+")");
options.series.push(data);
var chart=new Highcharts.Chart(options);
});
});
});
</script>