wpscatter24.jsp 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214
  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-MM-dd',isShowWeek:true,readOnly:true})"
  39. id="recorddate" name="recorddate" title="日期" />
  40. </td>
  41. <td width="200px" style="text-align: right">
  42. <input id="backbuttona" type="button" value="查询" onClick="queryData()" />
  43. </td>
  44. </tr>
  45. </table>
  46. </fieldset>
  47. <br/>
  48. <div id="main" style="height:700px;border:1px solid #ccc;padding:10px;"></div>
  49. <script type="text/javascript">
  50. // Step:3 echarts & zrender as a Global Interface by the echarts-plain.js.
  51. // Step:3 echarts和zrender被echarts-plain.js写入为全局接口
  52. var myChart = echarts.init(document.getElementById('main'));
  53. var option = {
  54. title : {
  55. text: '场站风向24小时走向情况'
  56. },
  57. tooltip : {
  58. trigger: 'axis'
  59. },
  60. legend: {
  61. data:['风速']
  62. },
  63. toolbox: {
  64. show : true,
  65. feature : {
  66. mark : {show: true},
  67. dataView : {show: true, readOnly: false},
  68. magicType : {show: true, type: ['line', 'bar', 'stack', 'tiled']},
  69. restore : {show: true},
  70. saveAsImage : {show: true}
  71. }
  72. },
  73. calculable : true,
  74. xAxis : [
  75. {
  76. type : 'category'
  77. }
  78. ],
  79. yAxis : [
  80. {
  81. type : 'value'
  82. }
  83. ],
  84. series : [
  85. {
  86. name:'风速',
  87. type:'line',
  88. symbol: 'arrow',
  89. symbolSize: 6,
  90. symbolRotate: -45,
  91. itemStyle: {
  92. normal: {
  93. color: 'red',
  94. lineStyle: { // 系列级个性化折线样式
  95. width: 2,
  96. type: 'dashed'
  97. }
  98. },
  99. emphasis: {
  100. color: 'blue'
  101. }
  102. },
  103. data: [
  104. ]
  105. }
  106. ]
  107. };
  108. // 使用刚指定的配置项和数据显示图表。
  109. queryData();
  110. function findscatter() {
  111. var wpId=$("#wpId").val();
  112. var recorddate=$("#recorddate").val();
  113. var url = "/winddirection/winddirectionAjax.action?wpId="+wpId
  114. +"&recorddate="+recorddate;
  115. $.ajax({
  116. url : url,
  117. type : "post",
  118. cache : false,
  119. dataType : "json",
  120. async : false,
  121. data : {},
  122. ifModified : false,
  123. success : function(result) {
  124. eval(result);
  125. var fx = [];
  126. var xtime = [];
  127. $.each(result, function(m, obj) {
  128. //if(m == result.length -1){
  129. if (obj.valueObjVo != null) {
  130. fx.push(obj.valueObjVo);
  131. }
  132. if(obj.timestr!= null )
  133. {
  134. xtime.push(obj.timestr);
  135. }
  136. });
  137. // 使用刚指定的配置项和数据显示图表。
  138. option.series[0].data = fx;
  139. option.xAxis[0].data = xtime;
  140. myChart.setOption(option);
  141. //options1.series[0].data = result;
  142. //chart1 = new Highcharts.Chart(options1);
  143. }
  144. });
  145. }
  146. function getForm(){
  147. //使用JQuery从后台获取JSON格式的数据
  148. jQuery.getJSON('http://localhost/resource/josn/test.json', null, function(data) {
  149. //为图表设置值
  150. // chart1.series[0].setData(data);
  151. options1.series[0].data=data;
  152. chart1 = new Highcharts.Chart(options1);
  153. });
  154. }
  155. function queryData(){
  156. if("" == $("#wpId").val()){
  157. alert("请选择风场!");
  158. }
  159. else if("" == $("#recorddate").val()){
  160. alert("请选择日期!");
  161. }
  162. else{
  163. findscatter();
  164. }
  165. }
  166. </script>
  167. </form>
  168. </body>