power.js 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237
  1. 
  2. var chart1;
  3. var options1;
  4. Highcharts.setOptions({
  5. global : {
  6. useUTC : false
  7. }
  8. });
  9. String.prototype.endWith=function(oString){
  10. var reg=new RegExp(oString+"$");
  11. return reg.test(this);
  12. }
  13. function wpAllInfoAjax() {
  14. $.ajax( {
  15. url : "windfarmrealtimeinfo.action?wfName=QS_FDC",
  16. type : "post",
  17. cache : false,
  18. dataType : "json",
  19. data : {},
  20. ifModified : false,
  21. success : function(res) {
  22. $("#zjrl").html(res["zjrl"] + "");
  23. $("#zgl").html(res["zgl"] + "");
  24. $("#pjfs").html(res["pjfs"] + "");
  25. $("#rfdl").html(res["rfdl"] + "");
  26. $("#yfdl").html(res["yfdl"] + "");
  27. $("#nfdl").html(res["nfdl"] + "");
  28. $("#yxts").html(res["yxts"] + "");
  29. $("#djts").html(res["djts"] + "");
  30. $("#whts").html(res["whts"] + "");
  31. $("#gzts").html(res["gzts"] + "");
  32. $("#lxts").html(res["lxts"] + "");
  33. $("#xdts").html(res["xdts"] + "");
  34. $("#jrts").html(res["jrts"] + "");
  35. $("#wd").html(res["wd"] + "");
  36. }
  37. });
  38. }
  39. options1= {
  40. colors: [
  41. '#00B259', //绿
  42. '#B20000', //红
  43. '#006DD9', //蓝
  44. '#000000', //黑
  45. '#FFBFFF',//藕荷色
  46. '#FF8000'//橘黄
  47. ],
  48. chart: {
  49. renderTo: 'container1',
  50. type: 'spline',
  51. //backgroundColor:'#BFDFFF',
  52. //plotBackgroundColor:'#BFDFFF',
  53. zoomType: 'x',
  54. events: {
  55. }
  56. },
  57. title: {
  58. text: '功率曲线'
  59. },
  60. subtitle: {
  61. text: ''
  62. },
  63. xAxis: {
  64. labels: {
  65. align: 'center',
  66. formatter: function() {
  67. return Highcharts.dateFormat('%H<br/>%M', this.value);
  68. }
  69. },
  70. type: 'datetime'
  71. },
  72. yAxis: [{
  73. title: {
  74. text: '功率数值(MW)'
  75. }
  76. },{
  77. title:{
  78. text :'风速(m/s)'
  79. },
  80. labels:{
  81. formatter: function(){
  82. return this.value;
  83. }
  84. },
  85. lineWidth : 1,
  86. opposite:true
  87. }],
  88. legend: {
  89. layout: 'vertical',
  90. // backgroundColor: '#FFFFFF',
  91. align: 'right',
  92. verticalAlign: 'top',
  93. floating: true
  94. // shadow: true
  95. // layout: 'vertical',
  96. // align: 'right',
  97. // verticalAlign: 'middle',
  98. // borderWidth: 0
  99. },
  100. tooltip: {
  101. crosshairs:{//控制十字线
  102. width:2
  103. },
  104. shared:true,
  105. xDateFormat:'%Y-%m-%d %H:%M'
  106. /*formatter: function() {
  107. return '<b>'+ this.series.name +'</b>:'+
  108. Highcharts.numberFormat(this.y, 2) +' 万kW<br/>时间:'+
  109. Highcharts.dateFormat('%Y-%m-%d %H:%M:%S', this.x);
  110. }*/
  111. },
  112. credits: {
  113. enabled: false
  114. },
  115. plotOptions: {
  116. spline: {
  117. dataLabels : {
  118. enabled :false
  119. },
  120. // pointPadding: 0.2,
  121. borderWidth: 0
  122. },
  123. series: {
  124. cursor: 'pointer',
  125. marker: {
  126. radius: 0,
  127. symbol: 'circle' //曲线点类型:"circle", "square", "diamond", "triangle","triangle-down",默认是"circle"
  128. }
  129. }
  130. },
  131. series: [{
  132. type: 'spline',
  133. name: '应发功率(单位:MW)',
  134. yAxis:0
  135. },
  136. {
  137. type: 'spline',
  138. name: '实发功率(单位:MW)',
  139. yAxis:0
  140. },
  141. {
  142. type: 'spline',
  143. name: '理论功率(单位:MW)',
  144. yAxis:0
  145. },
  146. {
  147. type: 'spline',
  148. name: '预测功率(单位:MW)',
  149. yAxis:0
  150. },
  151. {
  152. type: 'spline',
  153. name: '保证功率(单位:MW)',
  154. yAxis:0
  155. },{
  156. type: 'spline',
  157. name: '平均风速',
  158. yAxis:1
  159. }]
  160. };
  161. function apdata(){
  162. var url = "windfarmpower.action?wfName=QS_FDC"
  163. $.ajax({
  164. url : url,
  165. type : "post",
  166. cache : false,
  167. dataType : "json",
  168. data : {},
  169. ifModified : false,
  170. success : function(result) {
  171. var yfgl = [];
  172. var sjgl = [];
  173. var lvgl = [];
  174. var ycgl = [];
  175. var bzgl = [];
  176. var pjfs = [];
  177. var xtime=[];
  178. var index=0;
  179. var count=0;
  180. $.each(result, function(m, obj) {
  181. //if(m == result.length -1){
  182. if(index<obj.value7){
  183. index++;
  184. if(obj.value4!=null)
  185. {
  186. ycgl.push( parseFloat(obj.value4) );
  187. }else
  188. {
  189. ycgl.push( null );
  190. }
  191. }
  192. if(count<obj.value8){
  193. yfgl.push( parseFloat(obj.value1) );
  194. sjgl.push( parseFloat(obj.value2) );
  195. lvgl.push( parseFloat(obj.value3) );
  196. bzgl.push( parseFloat(obj.value5) );
  197. pjfs.push( parseFloat(obj.value6) );
  198. count++;
  199. }
  200. xtime.push(parseFloat(obj.time));
  201. });
  202. options1.series[0].data = yfgl;
  203. options1.series[1].data = sjgl;
  204. options1.series[2].data = lvgl;
  205. options1.series[3].data = ycgl;
  206. options1.series[4].data = bzgl;
  207. options1.series[5].data = pjfs;
  208. options1.xAxis.categories = xtime;
  209. chart1 = new Highcharts.Chart(options1);
  210. }
  211. });
  212. }