gaugeChart.jsp
3.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
<%--
Created by IntelliJ IDEA.
User: kangmor
Date: 2016/4/23
Time: 21:56
--%>
<%@ include file="/common/taglibs.jsp" %>
<%@ page language="java" pageEncoding="UTF-8" %>
<!-- BEGIN PAGE HEADER-->
<div class="row">
<div class="col-md-12">
<div class="portlet box yellow">
<div class="portlet-title">
<div class="caption">
<i class="fa fa-gift"></i>实时温度
</div>
<div class="tools">
<a class="config" data-toggle="modal" href="#portlet-config" data-original-title="" title="">
</a>
<a class="reload" href="javascript:;" data-original-title="" title="">
</a>
</div>
</div>
<div class="portlet-body" style="height:500px">
<div id="wendu" style="float:left;width:45%;height: 100%;"></div>
<div id="shidu" style="float:left;width:45%;height: 100%;"></div>
</div>
</div>
</div>
</div>
</div>
<c:set var="scripts" scope="request">
<script src="${ctx}/scripts/echarts.min.js"></script>
<script type="text/javascript">
shidu();
wendu();
function wendu(){
var dom = document.getElementById("wendu");
var wenduChart = echarts.init(dom);
var app = {};
var wenduoption = null;
wenduoption = {
tooltip : {
formatter: "{a} <br/>{b} : {c}℃"
},
toolbox: {
feature: {
restore: {},
saveAsImage: {}
}
},
series: [
{
name: '温度',
type: 'gauge',
detail: {formatter:'{value}℃'},
data: [{value: 50, name: '温度'}]
}
]
};
app.timeTicket = setInterval(function () {
wenduoption.series[0].data[0].value = (Math.random() * 100).toFixed(2) - 0;
wenduChart.setOption(wenduoption, true);
},2000);
}
function shidu(){
var dom = document.getElementById("shidu");
var myChart = echarts.init(dom);
var app = {};
option = null;
option = {
tooltip : {
formatter: "{a} <br/>{b} : {c}%"
},
toolbox: {
feature: {
restore: {},
saveAsImage: {}
}
},
series: [
{
name: '湿度',
type: 'gauge',
detail: {formatter:'{value}%'},
data: [{value: 50, name: '相对湿度'}]
}
]
};
app.timeTicket = setInterval(function () {
option.series[0].data[0].value = (Math.random() * 100).toFixed(2) - 0;
myChart.setOption(option, true);
},2000);
}
</script>
</c:set>