wtcurve.jsp 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460
  1. <%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
  2. <%@include file="/pages/includes/taglibs.jsp" %>
  3. <head>
  4. <script type="text/javascript" src="<%=request.getContextPath() %>/resource/js/jquery-1.8.3.js"></script>
  5. <script type="text/ecmascript" src="<%=request.getContextPath() %>/resource/plugin/jqgrid/js/jquery.jqGrid.min.js"></script>
  6. <script type="text/ecmascript" src="<%=request.getContextPath() %>/pages/health/wtcurve.js"></script>
  7. <script src="<%=request.getContextPath()%>/resource/js/datePicker/WdatePicker.js" type="text/javascript"></script>
  8. <link rel="stylesheet" type="text/css" href="<%=request.getContextPath() %>/resource/plugin/jqueryui/css/custom-theme/jquery-ui-1.9.2.custom.css" />
  9. <link rel="stylesheet" type="text/css" media="screen" href="<%=request.getContextPath() %>/resource/plugin/jqgrid/css/ui.jqgrid.css" />
  10. <script type="text/ecmascript" src="<%=request.getContextPath()%>/resource/plugin/jqueryui/js/jquery-ui-1.9.2.custom.min.js"></script>
  11. <script src="<%=request.getContextPath()%>/resource/js/highcharts/highcharts.src.js" type="text/javascript"></script>
  12. <script src="<%=request.getContextPath()%>/resource/js/highcharts/highcharts-more.js"> </script>
  13. <script src="<%=request.getContextPath()%>/resource/js/highcharts/modules/solid-gauge.src.js"></script>
  14. <script src="<%=request.getContextPath()%>/resource/js/echarts/echarts-all.js"></script>
  15. <style type="text/css">
  16. a{ /* 统一设置所以样式 */
  17. font-family:Arial;
  18. font-size:12px;
  19. text-align:center;
  20. margin:3px;
  21. }
  22. a:link,a:visited{ /* 超链接正常状态、被访问过的样式 */
  23. color:#000000;
  24. padding:4px 10px 4px 10px;
  25. background-color:#f1f1f1;
  26. text-decoration:none;
  27. border-top:1px solid #EEEEEE; /* 边框实现阴影效果 */
  28. border-left:1px solid #EEEEEE;
  29. border-bottom:1px solid #717171;
  30. border-right:1px solid #717171;
  31. }
  32. a:hover{ /* 鼠标指针经过时的超链接 */
  33. color:#821818; /* 改变文字颜色 */
  34. padding:5px 8px 3px 12px; /* 改变文字位置 */
  35. background-color:#e2c4c9; /* 改变背景色 */
  36. border-top:1px solid #717171; /* 边框变换,实现“按下去”的效果 */
  37. border-left:1px solid #717171;
  38. border-bottom:1px solid #EEEEEE;
  39. border-right:1px solid #EEEEEE;
  40. }
  41. fieldset legend {
  42. color:#302A2A;
  43. font: bold 16px/2 Verdana, Geneva, sans-serif;
  44. font-weight: bold;
  45. text-align: left;
  46. text-shadow: 2px 2px 2px rgb(88, 126, 156);
  47. }
  48. </style>
  49. <script type="text/javascript">
  50. function displaybuttons(cellvalue, options, rawObject) {
  51. var detail = "<input type='button' value='曲线趋势' onclick=curvefindByIds('"
  52. + rawObject.wtId + "','"
  53. + rawObject.rd + "')>";
  54. /* var history = "<input type='button' value='散点趋势' onclick=scatterfindByIds('"
  55. + rawObject.wtId + "','" + rawObject.rd + "')>";
  56. */
  57. return "&nbsp;&nbsp;&nbsp;\t" + detail + "&nbsp;&nbsp;&nbsp;\t"
  58. /* + history+ "&nbsp;&nbsp;&nbsp;\t" */;
  59. };
  60. function queryData(){
  61. $("#gridTable").jqGrid('GridUnload');
  62. showJqGrid();
  63. }
  64. var options;
  65. var chart;
  66. $(document).ready(function () {
  67. showJqGrid();
  68. options = {
  69. chart : {
  70. renderTo : 'container',
  71. type : 'spline'
  72. },
  73. title : {
  74. text : '单机区间曲线偏差率'
  75. },
  76. xAxis : {
  77. categories : [],
  78. labels : {
  79. rotation : -45,
  80. align : 'right',
  81. style : {
  82. fontSize : '13px',
  83. fontFamily : 'Verdana, sans-serif'
  84. }
  85. }
  86. },
  87. yAxis : {
  88. title : {
  89. text : '功率(MW)'
  90. }
  91. },
  92. tooltip : {
  93. headerFormat : '<b>{series.name}</b><br/>',
  94. pointFormat : ' {point.y}MW'
  95. },
  96. plotOptions : {
  97. spline : {
  98. marker : {
  99. enable : false
  100. }
  101. }
  102. },
  103. series: [{
  104. name: '',
  105. data: []
  106. }, {
  107. name: '',
  108. data: []
  109. }]
  110. }
  111. });
  112. function showJqGrid() {
  113. var wpId=$("#wpId").find("option:selected").val();
  114. var recodedate=$("#recodedate").val();
  115. var id = 'gridTable';
  116. var url = '<%=request.getContextPath() %>/wtcurve/wtcurvelist.action?wpId='+wpId
  117. +"&recodedate="+recodedate;
  118. var datatype = 'json';
  119. var colNames = ['风机', '日期','3-5米曲线偏差率','5-11米曲线偏差率','11-25米曲线偏差率','操作'];
  120. var colModel = [
  121. { name: 'wtId', index: 'wtId', width: 250, align: 'center'},
  122. { name: 'rd', index: 'rd', width: 250, align: 'center'},
  123. { name: 'qxpc1', index: 'qxpc1', width: 250, align: 'center', formatter:'number', formatoptions:{decimalPlaces: 2},sorttype: 'int'},
  124. { name: 'qxpc2', index: 'qxpc2', width: 250, align: 'center', formatter:'number', formatoptions:{decimalPlaces: 2},sorttype: 'int'},
  125. { name: 'qxpc3', index: 'qxpc3', width: 250, align: 'center', formatter:'number', formatoptions:{decimalPlaces: 2},sorttype: 'int'},
  126. { name: 'op', index: 'op', width: 230, align: 'center',formatter:displaybuttons}
  127. ];
  128. var caption = '单机区间曲线偏差率';
  129. var sortname = 'wtId';
  130. var gridPagerID ='gridPager';
  131. var sortorder='desc';
  132. var height='auto';
  133. var width='auto';
  134. var rownumbers=true;
  135. var multiselect=false;
  136. myJqGrid(id, url, datatype, colNames, colModel, caption, sortname, gridPagerID,sortorder,height,width,
  137. multiselect,rownumbers);}
  138. function curvefindByIds(wtId,recodedate){
  139. curveChartAjax(wtId,recodedate);
  140. $("#chartContainer1").dialog({
  141. title:"曲线趋势",
  142. resizable: false,
  143. width:1390,
  144. height:805,
  145. modal: true,
  146. beforeClose: function (evt, ui) {
  147. // clearInterval(resshData);
  148. }
  149. });
  150. }
  151. function scatterfindByIds(wtId,recodedate){
  152. $("#chartContainer2").dialog({
  153. title:"散点趋势",
  154. resizable: false,
  155. width:1390,
  156. height:805,
  157. modal: true,
  158. beforeClose: function (evt, ui) {
  159. // clearInterval(resshData);
  160. }
  161. });
  162. scatterChartAjax(wtId,recodedate);
  163. }
  164. function curveChartAjax(wtId,recodedate) {
  165. $("#container").html();
  166. var type="sjbz";
  167. var url ="../charts/curvechatAjax.action?windturbineid=" + wtId
  168. + "&beginDate=" + recodedate + "&type=" + type;
  169. $.ajax( {
  170. url : url,
  171. type : "post",
  172. cache : false,
  173. dataType : "json",
  174. data : {},
  175. ifModified : false,
  176. success : function(result) {
  177. var sj = [];
  178. var zy = [];
  179. var fu = [];
  180. var name1=wtId+"_"+result["name1"];
  181. var name2=wtId+"_"+result["name2"];
  182. $.each(result["datas"], function(m, obj) {
  183. if (obj.value1 != null) {
  184. fu.push(parseFloat(obj.value1));
  185. }
  186. if (obj.value2 != null) {
  187. sj.push(parseFloat(obj.value2));
  188. }
  189. if (obj.value3 != null) {
  190. zy.push(parseFloat(obj.value3));
  191. }
  192. });
  193. options.series[0].data = sj;
  194. options.series[0].name = name1;
  195. options.series[1].data = zy;
  196. options.series[1].name = name2;
  197. options.xAxis.categories = fu;
  198. chart = new Highcharts.Chart(options);
  199. //alert(options.xAxis.categories);
  200. }
  201. });
  202. }
  203. </script>
  204. <style type="text/css">
  205. fieldset legend {
  206. color:#302A2A;
  207. font: bold 16px/2 Verdana, Geneva, sans-serif;
  208. font-weight: bold;
  209. text-align: left;
  210. text-shadow: 2px 2px 2px rgb(88, 126, 156);
  211. }
  212. </style>
  213. </head>
  214. <body>
  215. <form action="" method="post" id="f1">
  216. <fieldset style="height: 60px" id="fst">
  217. <legend class="item_Name">查询条件</legend>
  218. <table width="1000px" cellpadding="0" cellspacing="0" class="dataform">
  219. <tr>
  220. <th width="100px" class="item_Name">
  221. 风场:
  222. </th>
  223. <td width="100px" class="item_Name">
  224. <s:select list="wps" cssStyle="width:100px" listKey="id" listValue="name" id="wpId" name="wpId" onchange="javascript:queryData();"></s:select>
  225. </td>
  226. <th width="100px" class="item_Name">
  227. 日期
  228. </th>
  229. <td width="100px" style="text-align: left">
  230. <s:textfield cssClass="Wdate" onFocus="WdatePicker({dateFmt:'yyyy-MM-dd',isShowWeek:true,readOnly:true})"
  231. id="recodedate" name="recodedate" title="日期" onchange="javascript:queryData();"/>
  232. </td>
  233. </tr>
  234. </table>
  235. </fieldset>
  236. <br/>
  237. <table id='gridTable' >
  238. </table>
  239. <div id='gridPager'></div>
  240. </form>
  241. <div style="width:1380px;height:600px;display:none;align:center;valign:middle" id="chartContainer1">
  242. <div id="container">
  243. </div>
  244. </div>
  245. <div style="width:1380px;height:800px;display:none;align:center;valign:middle" id="chartContainer2">
  246. <div id="container2" style="width:1350px;height: 700px; border: 1px solid #ccc; padding: 10px;">
  247. </div>
  248. </div>
  249. <script type="text/javascript">
  250. // Step:3 echarts & zrender as a Global Interface by the echarts-plain.js.
  251. // Step:3 echarts和zrender被echarts-plain.js写入为全局接口
  252. var myChart = echarts.init(document.getElementById('container2'));
  253. var option = {
  254. title : {
  255. text : '风机功率风速排布情况'
  256. },
  257. tooltip : {
  258. trigger : 'axis',
  259. showDelay : 0,
  260. formatter : function(params) {
  261. if (params.value.length > 0) {
  262. return params.seriesName + ' :<br/>' + params.value[0] + 'kw ';
  263. } else {
  264. return params.seriesName + ' :<br/>' + params.value + 'kw ';
  265. }
  266. },
  267. axisPointer : {
  268. show : true,
  269. type : 'cross',
  270. lineStyle : {
  271. type : 'dashed',
  272. width : 1
  273. }
  274. }
  275. },
  276. legend : {
  277. data : [ '功率' ]
  278. },
  279. toolbox : {
  280. show : true,
  281. feature : {
  282. mark : {
  283. show : true
  284. },
  285. dataZoom : {
  286. show : true
  287. },
  288. dataView : {
  289. show : true,
  290. readOnly : false
  291. },
  292. restore : {
  293. show : true
  294. },
  295. saveAsImage : {
  296. show : true
  297. }
  298. }
  299. },
  300. xAxis : [ {
  301. type : 'value',
  302. scale : true,
  303. splitNumber:25,
  304. axisLabel : {
  305. formatter : '{value} m/s'
  306. }
  307. } ],
  308. yAxis : [ {
  309. type : 'value',
  310. scale : true,
  311. axisLabel : {
  312. formatter : '{value} kw'
  313. }
  314. } ],
  315. series : [ {
  316. name : '功率',
  317. type : 'scatter',
  318. large : true,
  319. data : [],
  320. markPoint : {
  321. data : [ {
  322. type : 'max',
  323. name : '最大值'
  324. }, {
  325. type : 'min',
  326. name : '最小值'
  327. } ]
  328. },
  329. markLine : {
  330. data : [ {
  331. type : 'average',
  332. name : '平均值'
  333. } ]
  334. }
  335. },
  336. {
  337. name : '拟合功率',
  338. type : 'line' ,
  339. color:['black'],
  340. data : []
  341. }
  342. ]};
  343. /********************************************************************************/
  344. function scatterChartAjax(wtId,recodedate) {
  345. var url = "/wtcurve/scatterWtAjax.action?wtId=" + wtId + "&recodedate=" + recodedate;
  346. $.ajax( {
  347. url : url,
  348. type : "post",
  349. cache : false,
  350. dataType : "json",
  351. async : false,
  352. data : {},
  353. ifModified : false,
  354. success : function(result) {
  355. // 使用刚指定的配置项和数据显示图表。
  356. option.series[0].data = result["scatter"];
  357. option.series[1].data = result["line"];
  358. myChart.setOption(option);
  359. //options1.series[0].data = result;
  360. //chart1 = new Highcharts.Chart(options1);
  361. }
  362. });
  363. }
  364. </script>
  365. </body>