benchmark.js 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340
  1. var chartfc;
  2. var chartgf;
  3. var optionsfc;
  4. var optionsgf;
  5. Highcharts.setOptions({
  6. global : {
  7. useUTC : false
  8. }
  9. });
  10. optionsfc = {
  11. colors: [
  12. '#19FF38',
  13. '#0026FF',
  14. '#FF350C'
  15. ],
  16. chart: {
  17. renderTo: 'chartfc',
  18. type: 'spline',
  19. //backgroundColor:'#BFDFFF',
  20. //plotBackgroundColor:'#BFDFFF',
  21. zoomType: 'x',
  22. events: {
  23. }
  24. },
  25. title: {
  26. text: '风场实时功率'
  27. },
  28. subtitle: {
  29. text: ''
  30. },
  31. xAxis: {
  32. labels: {
  33. align: 'center',
  34. formatter: function() {
  35. return Highcharts.dateFormat('%H<br/>%M', this.value);
  36. }
  37. },
  38. type: 'datetime'
  39. },
  40. yAxis: [{
  41. title: {
  42. text: '功率(MW)'
  43. }
  44. }],
  45. legend: {
  46. layout: 'vertical',
  47. // backgroundColor: '#FFFFFF',
  48. align: 'left',
  49. verticalAlign: 'top',
  50. floating: true
  51. // shadow: true
  52. // layout: 'vertical',
  53. // align: 'right',
  54. // verticalAlign: 'middle',
  55. // borderWidth: 0
  56. },
  57. tooltip: {
  58. shared:true,
  59. xDateFormat:'%Y-%m-%d %H:%M '
  60. /*formatter: function() {
  61. return '<b>'+ this.series.name +'</b>:'+
  62. Highcharts.numberFormat(this.y, 2) +' 万kW<br/>时间:'+
  63. Highcharts.dateFormat('%Y-%m-%d %H:%M:%S', this.x);
  64. }*/
  65. },
  66. credits: {
  67. enabled: false
  68. },
  69. plotOptions: {
  70. spline: {
  71. dataLabels : {
  72. enabled :false
  73. },
  74. // pointPadding: 0.2,
  75. borderWidth: 0
  76. },
  77. column: {
  78. pointPadding: 0.2,
  79. borderWidth: 0
  80. },
  81. series: {
  82. cursor: 'pointer',
  83. marker: {
  84. radius: 0,
  85. symbol: 'circle' //曲线点类型:"circle", "square", "diamond", "triangle","triangle-down",默认是"circle"
  86. }
  87. }
  88. },
  89. series: [{
  90. name: '预测功率(MW)',
  91. yAxis:0
  92. },
  93. {
  94. name: '实际功率(MW)',
  95. yAxis:0
  96. },{
  97. name: '应发功率(MW)',
  98. yAxis:0
  99. }]
  100. };
  101. optionsgf = {
  102. colors: [
  103. '#19FF38',
  104. '#0026FF',
  105. '#FF350C'
  106. ],
  107. chart: {
  108. renderTo: 'chartgf',
  109. type: 'spline',
  110. //backgroundColor:'#BFDFFF',
  111. //plotBackgroundColor:'#BFDFFF',
  112. zoomType: 'x',
  113. events: {
  114. }
  115. },
  116. title: {
  117. text: '电站实时功率'
  118. },
  119. subtitle: {
  120. text: ''
  121. },
  122. xAxis: {
  123. labels: {
  124. align: 'center',
  125. formatter: function() {
  126. return Highcharts.dateFormat('%H<br/>%M', this.value);
  127. }
  128. },
  129. type: 'datetime'
  130. },
  131. yAxis: [{
  132. title: {
  133. text: '功率(MW)'
  134. }
  135. }],
  136. legend: {
  137. layout: 'vertical',
  138. // backgroundColor: '#FFFFFF',
  139. align: 'left',
  140. verticalAlign: 'top',
  141. floating: true
  142. // shadow: true
  143. // layout: 'vertical',
  144. // align: 'right',
  145. // verticalAlign: 'middle',
  146. // borderWidth: 0
  147. },
  148. tooltip: {
  149. shared:true,
  150. xDateFormat:'%Y-%m-%d %H:%M '
  151. /*formatter: function() {
  152. return '<b>'+ this.series.name +'</b>:'+
  153. Highcharts.numberFormat(this.y, 2) +' 万kW<br/>时间:'+
  154. Highcharts.dateFormat('%Y-%m-%d %H:%M:%S', this.x);
  155. }*/
  156. },
  157. credits: {
  158. enabled: false
  159. },
  160. plotOptions: {
  161. spline: {
  162. dataLabels : {
  163. enabled :false
  164. },
  165. // pointPadding: 0.2,
  166. borderWidth: 0
  167. },
  168. column: {
  169. pointPadding: 0.2,
  170. borderWidth: 0
  171. },
  172. series: {
  173. cursor: 'pointer',
  174. marker: {
  175. radius: 0,
  176. symbol: 'circle' //曲线点类型:"circle", "square", "diamond", "triangle","triangle-down",默认是"circle"
  177. }
  178. }
  179. },
  180. series: [{
  181. name: '预测功率(MW)',
  182. yAxis:0
  183. },
  184. {
  185. name: '实际功率(MW)',
  186. yAxis:0
  187. },{
  188. name: '应发功率(MW)',
  189. yAxis:0
  190. }]
  191. };
  192. $(document).ready(
  193. function(){
  194. chartfc=new Highcharts.Chart(optionsfc);
  195. chartgf=new Highcharts.Chart(optionsgf);
  196. realfc();
  197. realgf();
  198. window.setInterval(realfc,60000);
  199. window.setInterval(realgf,80000);
  200. }
  201. );
  202. function realfc(){
  203. $.ajax({
  204. url : 'realFcAjax.action',
  205. type : "post",
  206. cache : false,
  207. dataType : "json",
  208. data : {},
  209. ifModified : false,
  210. success : function(result) {
  211. var ycgl = [];
  212. var sjgl = [];
  213. var pjfs = [];
  214. var xtime = [];
  215. var index=0;
  216. var count=0;
  217. $.each(result, function(m, obj) {
  218. //if(m == result.length -1){
  219. if(index<obj.value4){
  220. index++;
  221. ycgl.push( parseFloat(obj.value1) );
  222. xtime.push(parseFloat(obj.time));
  223. }
  224. if(count<obj.value5){
  225. sjgl.push( parseFloat(obj.value2) );
  226. pjfs.push( parseFloat(obj.value3) );
  227. count++;
  228. }
  229. });
  230. if (chartfc) {
  231. //chart.redraw();
  232. chartfc.series[0].setData(ycgl);
  233. chartfc.series[1].setData(sjgl);
  234. chartfc.series[2].setData(pjfs);
  235. //chart.series[3].setData(cftfs);
  236. //optionsfc.xAxis.categories = xtime;
  237. if(chartfc.xAxis[0]){
  238. chartfc.xAxis[0].setCategories(xtime);
  239. }
  240. else{
  241. chartfc.addAxis({categories:xtime},true);
  242. }
  243. } else {
  244. optionsfc.series[0].data = ycgl;
  245. optionsfc.series[1].data = sjgl;
  246. optionsfc.series[2].data = pjfs;
  247. optionsfc.xAxis.categories = xtime;
  248. chartfc = new Highcharts.Chart(optionsfc);
  249. }
  250. }
  251. });
  252. }
  253. function realgf(){$.ajax({
  254. url : 'realGfAjax.action',
  255. type : "post",
  256. cache : false,
  257. dataType : "json",
  258. data : {},
  259. ifModified : false,
  260. success : function(result) {
  261. var ycgl = [];
  262. var sjgl = [];
  263. var pjfs = [];
  264. var xtime = [];
  265. var index=0;
  266. var count=0;
  267. $.each(result, function(m, obj) {
  268. //if(m == result.length -1){
  269. if(index<obj.value4){
  270. index++;
  271. ycgl.push( parseFloat(obj.value1) );
  272. xtime.push(parseFloat(obj.time));
  273. }
  274. if(count<obj.value5){
  275. sjgl.push( parseFloat(obj.value2) );
  276. pjfs.push( parseFloat(obj.value3) );
  277. count++;
  278. }
  279. });
  280. if (chartgf) {
  281. //chart.redraw();
  282. chartgf.series[0].setData(ycgl);
  283. chartgf.series[1].setData(sjgl);
  284. chartgf.series[2].setData(pjfs);
  285. //chart.series[3].setData(cftfs);
  286. // optionsgf.xAxis.categories = xtime;
  287. if(chartgf.xAxis[0]){
  288. chartgf.xAxis[0].setCategories(xtime);
  289. }
  290. else{
  291. chartgf.addAxis({categories:xtime},true);
  292. }
  293. } else {
  294. optionsgf.series[0].data = ycgl;
  295. optionsgf.series[1].data = sjgl;
  296. optionsgf.series[2].data = pjfs;
  297. optionsgf.xAxis.categories = xtime;
  298. chartgf = new Highcharts.Chart(optionsgf);
  299. }
  300. }
  301. });
  302. }