wpscatter.jsp 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229
  1. <%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
  2. <%@include file="/pages/includes/taglibs.jsp" %>
  3. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
  4. <head>
  5. <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
  6. <%--<meta http-equiv="X-UA-Compatible" content="IE=7"></meta>--%>
  7. <meta http-equiv = "X-UA-Compatible" content = "IE=edge,chrome=1" />
  8. <script type="text/javascript" src="<%=request.getContextPath() %>/resource/js/jquery-1.8.3.js"></script>
  9. <script src="<%=request.getContextPath()%>/resource/js/datePicker/WdatePicker.js" type="text/javascript"></script>
  10. <link rel="stylesheet" type="text/css" href="<%=request.getContextPath() %>/resource/plugin/jqueryui/css/custom-theme/jquery-ui-1.9.2.custom.css" />
  11. <script src="<%=request.getContextPath()%>/resource/js/echarts/echarts-all.js"></script>
  12. <style type="text/css">
  13. fieldset legend {
  14. color:#302A2A;
  15. font: bold 16px/2 Verdana, Geneva, sans-serif;
  16. font-weight: bold;
  17. text-align: left;
  18. text-shadow: 2px 2px 2px rgb(88, 126, 156);
  19. }
  20. </style>
  21. </head>
  22. <body>
  23. <form action="wpscatterIndex.action" method="post" id="f1">
  24. <fieldset style="height: 60px" id="fst">
  25. <legend class="item_Name">查询条件</legend>
  26. <table width="1000px" cellpadding="0" cellspacing="0" class="dataform">
  27. <tr>
  28. <th width="100px" class="item_Name">
  29. 风场:
  30. </th>
  31. <td width="100px" class="item_Name">
  32. <s:select list="wps" cssStyle="width:100px" listKey="id" listValue="name" id="wpId" name="wpId" ></s:select>
  33. </td>
  34. <th width="100px" class="item_Name">
  35. 年份:
  36. </th>
  37. <td width="100px" style="text-align: left">
  38. <s:textfield cssClass="Wdate" onFocus="WdatePicker({dateFmt:'yyyy',isShowWeek:true,readOnly:true})"
  39. id="year" name="year" title="年份" />
  40. </td>
  41. <th width="100px" class="item_Name">
  42. 月份:
  43. </th>
  44. <td width="100px" style="text-align: left">
  45. <s:textfield cssClass="Wdate" onFocus="WdatePicker({dateFmt:'MM',isShowWeek:true,readOnly:true})"
  46. id="month" name="month" title="月份" />
  47. </td>
  48. <td width="200px" style="text-align: right">
  49. <input id="backbuttona" type="button" value="查询" onClick="queryData()" />
  50. </td>
  51. </tr>
  52. </table>
  53. </fieldset>
  54. <br/>
  55. <div id="main" style="height:700px;border:1px solid #ccc;padding:10px;"></div>
  56. <script type="text/javascript">
  57. // Step:3 echarts & zrender as a Global Interface by the echarts-plain.js.
  58. // Step:3 echarts和zrender被echarts-plain.js写入为全局接口
  59. var myChart = echarts.init(document.getElementById('main'));
  60. var option = {
  61. title : {
  62. text: '场站功率风速排布情况'
  63. },
  64. tooltip : {
  65. trigger: 'axis',
  66. showDelay : 0,
  67. formatter : function (params) {
  68. if (params.value.length > 0) {
  69. return params.seriesName + ' :<br/>'
  70. + params.value[0] + '万kw ';
  71. }
  72. else {
  73. return params.seriesName + ' :<br/>'
  74. + params.value + '万kw ';
  75. }
  76. },
  77. axisPointer:{
  78. show: true,
  79. type : 'cross',
  80. lineStyle: {
  81. type : 'dashed',
  82. width : 1
  83. }
  84. }
  85. },
  86. legend: {
  87. data:['功率']
  88. },
  89. toolbox: {
  90. show : true,
  91. feature : {
  92. mark : {show: true},
  93. dataZoom : {show: true},
  94. dataView : {show: true, readOnly: false},
  95. restore : {show: true},
  96. saveAsImage : {show: true}
  97. }
  98. },
  99. xAxis : [
  100. {
  101. type : 'value',
  102. scale:true,
  103. splitNumber:25,
  104. axisLabel : {
  105. formatter: '{value} m/s'
  106. }
  107. }
  108. ],
  109. yAxis : [
  110. {
  111. type : 'value',
  112. scale:true,
  113. axisLabel : {
  114. formatter: '{value} 万kw'
  115. }
  116. }
  117. ],
  118. series : [
  119. {
  120. name:'功率',
  121. type:'scatter',
  122. large: true,
  123. data: [
  124. ],
  125. markPoint : {
  126. data : [
  127. {type : 'max', name: '最大值'},
  128. {type : 'min', name: '最小值'}
  129. ]
  130. },
  131. markLine : {
  132. data : [
  133. {type : 'average', name: '平均值'}
  134. ]
  135. }
  136. }
  137. ]
  138. };
  139. // 使用刚指定的配置项和数据显示图表。
  140. queryData();
  141. function findscatter() {
  142. var wpId=$("#wpId").val();
  143. var year=$("#year").val();
  144. var month=$("#month").val();
  145. var url = "/scatter/scatterAjax.action?wpId="+wpId
  146. +"&year="+year +"&month="+month;
  147. $.ajax({
  148. url : url,
  149. type : "post",
  150. cache : false,
  151. dataType : "json",
  152. async : false,
  153. data : {},
  154. ifModified : false,
  155. success : function(result) {
  156. // 使用刚指定的配置项和数据显示图表。
  157. option.series[0].data = result;
  158. myChart.setOption(option);
  159. //options1.series[0].data = result;
  160. //chart1 = new Highcharts.Chart(options1);
  161. }
  162. });
  163. }
  164. function getForm(){
  165. //使用JQuery从后台获取JSON格式的数据
  166. jQuery.getJSON('http://localhost/resource/josn/test.json', null, function(data) {
  167. //为图表设置值
  168. // chart1.series[0].setData(data);
  169. options1.series[0].data=data;
  170. chart1 = new Highcharts.Chart(options1);
  171. });
  172. }
  173. function queryData(){
  174. if("" == $("#wpId").val()){
  175. alert("请选择风场!");
  176. }
  177. else if("" == $("#year").val()){
  178. alert("请选择年份!");
  179. }else if("" == $("#month").val()){
  180. alert("请选择月份!");
  181. }
  182. else{
  183. findscatter();
  184. }
  185. }
  186. </script>
  187. </form>
  188. </body>