81,091
社区成员
发帖
与我相关
我的任务
分享
public String showOracleLine(Oracle oracle){
int length=oracleService.getOracleNumList().size();
Map<String, Object> id = oracleService.getOracleInfo(oracle.getOracleId());
Map<String, Object> state = oracleService.getOracleInfo(oracle.getState());
System.out.println(oracle.getOracleId());
JSONArray json = JSONArray.fromObject(id);
json.add(state);
json.add(length);
result = json.toString();
return SUCCESS;
}
<action name="json_oracle_*" class="cn.horizon.platform.oracle.action.OracleAction" method="{1}">
<result type="json">
<param name="root">result</param>
</result>
</action>
<form id="lineForm">
<input type="hidden" name="oracleId" id="oraclId" />
</form>
<div class="kuangJiaURL metric" style="position: relative;margin-left:0px;height:300px">
<div id="showLine" style="width:100%;height:300px">
</div>
</div>
function showLine() {
var action = "${pageContext.request.contextPath}/json_oracle_showOracleLine.action";
var loadAChart = echarts.init(document.getElementById("showLine"));
var option = {
title : {
text : '数据库信息'
},
// 鼠标悬停信息
tooltip : {
trigger : 'axis'
},
// 工具箱
toolbox : {
left : 'right',
restore : {},
},
// 图例
legend : {
data : [],
textStyle : {
fontSize : 14,
fontWeight : 'bolder',
color : '#fff'
}
},
// 直角坐标系内绘网格
grid : {
containLabel : true,
right : 20,
left : 20
},
xAxis : {
type : 'category',
splitLine : {
show : false
},
data : [],
// 坐标轴轴线设置
axisLine : {
lineStyle : {
color : 'white',
type : 'solid',
width : 1
}
},
// 坐标轴刻度
axisTick : {
show : true,
interval : 'auto',
length : 5,
lineStyle : {
color : 'white',
width : 2,
}
},
},
yAxis : {
type : 'value',
splitNumber : 2,
// 坐标轴轴线设置
axisLine : {
show : false,
lineStyle : {
color : 'white',
type : 'solid',
width : 1
}
},
// 坐标轴文本标签
axisLabel : {
textStyle : {
color : "white",
fontSize : 12
}
},
},
// series : {
// type : 'line'
// },
};
loadAChart.showLoading();
loadAChart.setOption(option);
loadAChart.resize();
$.ajax({
type: "POST",
url: action,
contentType: "application/x-www-form-urlencoded; charset=utf-8",
data: $('#lineForm').serialize(),
dataType : "json",
success: function(data){
var ret = eval('(' + data + ')');
$("#showLine").show();
var option = {
xAxis : {
type : 'category',
data : ret.id,
boundaryGap:false
},
yAxis : {
type : 'category',
data : ret.state,
boundaryGap:false
},
series : [
{
name : '数据库信息',
type : 'line',
data : ret.data,
smooth: true,
lineStyle:{
normal:{
color:'#fb6f51'
}
}
}
]
};
loadAChart.hideLoading();
loadAChart.setOption(option);
loadAChart.resize();
}
})
}
function showline(){
var loadAChart = echarts.init(document.getElementById('showLine'));
var option = {
tooltip: {
trigger: 'axis'
},
title: {
text: '数据库信息',
top : '2%',
left : '10%',
textStyle : {
color : "white",
fontSize : 16
}
},
legend: {
top : '3%',
data:['信息'],
textStyle : {
color : "white",
fontSize : 14
}
},
xAxis: {
//坐标轴轴线设置
axisLine:{
lineStyle:{
color : 'white',
type : 'solid',
width : 2
}
},
//坐标轴文本标签
axisLabel : {
show : true,
interval:0,
textStyle : {
color : "white",
fontSize : 12
}
},
splitLine : {
show : false
},
type: 'category',
boundaryGap: false,
data: []
},
yAxis: {
type: 'value',
splitNumber:1,
//坐标轴轴线设置
axisLine:{
show:false,
lineStyle:{
color : 'white',
type : 'solid',
width : 1
}
},
//坐标轴文本标签
axisLabel : {
textStyle : {
color : "white",
fontSize : 12
}
},
//坐标轴刻度
axisTick : {
show : false,
//interval : 'auto',
//length : 5,
lineStyle : {
color : 'white',
width : 2,
}
},
},
series: [
/* {
data : [],
smooth: true,
lineStyle:{
normal:{
color:'#fb6f51'
}
}
} */
]
};
loadAChart.showLoading();
loadAChart.setOption(option);
$.ajax({
type: "POST",
url: "${pageContext.request.contextPath}/json_oracle_showOracleLine.action",
//contentType: "application/x-www-form-urlencoded; charset=utf-8",
//data : $("#targetForm").serialize(),
//dataType : "json",
success : function(data){
var ret = eval('(' + data + ')');
$("#showLine").show();
var option = {
xAxis : {
type : 'category',
data : ret.oracleId,
boundaryGap:false
},
// yAxis : {
// type : 'category',
// data : ret.state,
// boundaryGap:false
// },
series : [
{
name : '信息',
type : 'line',
data : ret.data,
smooth: true,
lineStyle:{
normal:{
color:'#fb6f51'
}
}
}
]
};
loadAChart.hideLoading();
loadAChart.setOption(option);
}
})
}