最近項目要做曲線報表
首先把highstock
頁面代碼
<script type=
<script type=
<script type=
<script >
$(document)
$(
var names = [];
$(
var ks = $(this)
if(ks ==
names
}
else if (ks ==
names
}
else if (ks ==
names
}
else if (ks ==
names
}
else if (ks ==
names
}
else if (ks ==
names
}
else if (ks ==
names
}
})
var seriesOptions = []
yAxisOptions = []
seriesCounter =
colors = Highcharts
$
//後台讀取json數據
$
//將json數據放入seriesOptions數組
seriesOptions[i] = {
name: name
data: data
};
seriesCounter++;
if (seriesCounter == names
//開始繪圖
createChart()
}
})
function createChart() {
window
chart : {
renderTo :
}
rangeSelector : {
selected :
}
title : {
text :
}
credits : {
enabled : false//去掉右下角的標志
}
rangeSelector: {
// 縮放選擇按鈕
// 其中type可以是
// 其中count是指多少個單位type
// 其中text是配置顯示在按鈕上的文字
buttons: [{
type:
count:
text:
}
type:
count:
text:
}
type:
count:
text:
}
type:
count:
text:
}
type:
count:
text:
}
type:
text:
}]
// 默認選擇域
selected:
// 是否允許input標簽選框
inputEnabled: false
}
//右上角日期區間格式化
rangeSelector:{
selected:
inputDateFormat:
}
xAxis: {
type:
//x軸時間的格式化
dateTimeLabelFormats: {
second:
minute:
hour:
day:
week:
month:
year:
}
}
yAxis : {
title : {
text :
}
labels: {
formatter: function() {
return (this
}
}
}
//彈出框的格式化顯示
tooltip: {
xDateFormat:
pointFormat:
valueDecimals:
}
series :seriesOptions
})
}
})
})
})
</script>
<div id=
後台其實就簡單了
@SuppressWarnings(
@RequestMapping(
@ResponseBody
public Map kan(HttpServletRequest request
int id = Integer
List<TempHumHistory> historyList = historyImpl
Map<String
modelMap
modelMap
modelMap
return modelMap;
}
From:http://tw.wingwit.com/Article/program/Java/ky/201311/28860.html