apdatahistory.js 5.5 KB

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