windtower.js 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486
  1. 
  2. var chart1;
  3. var chart2;
  4. var chart3;
  5. var chart4;
  6. var chart5;
  7. var options1;
  8. var options2;
  9. var options3;
  10. var options4;
  11. var options5;
  12. Highcharts.setOptions({
  13. global : {
  14. useUTC : false
  15. }
  16. });
  17. String.prototype.endWith=function(oString){
  18. var reg=new RegExp(oString+"$");
  19. return reg.test(this);
  20. }
  21. function windtowerAjax() {
  22. var wpid=$("#wpid").val();
  23. $.ajax({
  24. url : "windtowerAjax.action?windfarm="+wpid ,
  25. type : "post",
  26. cache : false,
  27. dataType : "json",
  28. data : {},
  29. ifModified : false,
  30. success : function(res) {
  31. $("#fs10").html(res["fs10"]);
  32. $("#fs30").html(res["fs30"]);
  33. $("#fs50").html(res["fs50"]);
  34. $("#fs70").html(res["fs70"]);
  35. $("#fs80").html(res["fs80"]);
  36. $("#fx10").html(res["fx10"]);
  37. $("#fx30").html(res["fx30"]);
  38. $("#fx50").html(res["fx50"]);
  39. $("#fx70").html(res["fx70"]);
  40. $("#fx80").html(res["fx80"]);
  41. $("#wd").html(res["wd"]);
  42. $("#sd").html(res["sd"]);
  43. $("#yq").html(res["yq"]);
  44. if(chart3.series[0])
  45. {
  46. var point = chart3.series[0].points[0];
  47. point.update(res["wd"]);
  48. }
  49. if(chart4.series[0])
  50. {
  51. var point = chart4.series[0].points[0];
  52. point.update(res["sd"]);
  53. }
  54. if(chart5.series[0])
  55. {
  56. var point = chart5.series[0].points[0];
  57. point.update(res["yq"]);
  58. }
  59. }
  60. });
  61. }
  62. function daychart() {
  63. var wpid=$("#wpid").val();
  64. var url = "dayfzy.action?windfarm="+wpid ;
  65. $.ajax( {
  66. url : url,
  67. type : "post",
  68. cache : false,
  69. dataType : "json",
  70. data : {},
  71. ifModified : false,
  72. success : function(result) {
  73. var data1 = [];
  74. var jfpl=result.jfpl;
  75. $.each(result.data, function(m, obj) {
  76. if (obj.data1 != null) {
  77. data1.push(parseFloat(obj.data1));
  78. }
  79. });
  80. if(null !=options1.series[0])
  81. {
  82. options1.series[0].data = data1;
  83. }
  84. options1.series[0].name = jfpl;
  85. chart1 = new Highcharts.Chart(options1);
  86. }
  87. });
  88. }
  89. function monthchart() {
  90. var wpid=$("#wpid").val();
  91. var url = "monthfzy.action?windfarm="+wpid ;
  92. $.ajax( {
  93. url : url,
  94. type : "post",
  95. cache : false,
  96. dataType : "json",
  97. data : {},
  98. ifModified : false,
  99. success : function(result) {
  100. var data1 = [];
  101. var jfpl=result.jfpl;
  102. $.each(result.data, function(m, obj) {
  103. if (obj.data1 != null) {
  104. data1.push(parseFloat(obj.data1));
  105. }
  106. });
  107. if(null !=options2.series[0])
  108. {
  109. options2.series[0].data = data1;
  110. }
  111. options2.series[0].name = jfpl;
  112. chart2 = new Highcharts.Chart(options2);
  113. }
  114. });
  115. }
  116. $(document).ready(
  117. function() {
  118. options3 = {
  119. chart: {
  120. renderTo: 'container3',
  121. type: 'solidgauge',
  122. events: {
  123. click: function (event) {
  124. findPJFSDetail();
  125. }
  126. }
  127. },
  128. title: null,
  129. pane: {
  130. center: ['50%', '75%'],
  131. size: '100%',
  132. startAngle: -90,
  133. endAngle: 90,
  134. background: {
  135. backgroundColor: (Highcharts.theme && Highcharts.theme.background2) || '#EEE',
  136. innerRadius: '60%',
  137. outerRadius: '100%',
  138. shape: 'arc'
  139. }
  140. },
  141. tooltip: {
  142. enabled: false
  143. },
  144. // the value axis
  145. yAxis: {
  146. stops: [
  147. [0.1, '#55BF3B'], // green
  148. [0.5, '#DDDF0D'], // yellow
  149. [0.9, '#DF5353'] // red
  150. ],
  151. lineWidth: 0,
  152. minorTickInterval: null,
  153. tickPixelInterval: 400,
  154. tickWidth: 0,
  155. title: {
  156. y: -10
  157. },
  158. labels: {
  159. y: 0
  160. },
  161. min: -50,
  162. max: 50,
  163. title: {
  164. text: null
  165. }
  166. },
  167. plotOptions: {
  168. solidgauge: {
  169. dataLabels: {
  170. y: 15,
  171. borderWidth: 0,
  172. useHTML: true
  173. }
  174. }
  175. },
  176. credits: {
  177. enabled: false
  178. },
  179. series: [{
  180. name: '温度',
  181. data: [12],
  182. dataLabels: {
  183. format: '<div style="text-align:center"><span style="font-size:18px;color:' +
  184. ((Highcharts.theme && Highcharts.theme.contrastTextColor) || 'black') + '">{y}</span><br/>' +
  185. '<span style="font-size:12px;color:silver">温度</span></div>'
  186. },
  187. tooltip: {
  188. valueSuffix: ' '
  189. }
  190. }]
  191. };
  192. options4 = {
  193. chart: {
  194. renderTo: 'container4',
  195. type: 'solidgauge',
  196. events: {
  197. click: function (event) {
  198. findBZGLDetail();
  199. }
  200. }
  201. },
  202. title: null,
  203. pane: {
  204. center: ['50%', '75%'],
  205. size: '100%',
  206. startAngle: -90,
  207. endAngle: 90,
  208. background: {
  209. backgroundColor: (Highcharts.theme && Highcharts.theme.background2) || '#EEE',
  210. innerRadius: '60%',
  211. outerRadius: '100%',
  212. shape: 'arc'
  213. }
  214. },
  215. tooltip: {
  216. enabled: false
  217. },
  218. // the value axis
  219. yAxis: {
  220. stops: [
  221. [0.1, '#55BF3B'], // green
  222. [0.5, '#DDDF0D'], // yellow
  223. [0.9, '#DF5353'] // red
  224. ],
  225. lineWidth: 0,
  226. minorTickInterval: null,
  227. tickPixelInterval: 400,
  228. tickWidth: 0,
  229. title: {
  230. y: -10
  231. },
  232. labels: {
  233. y: 0
  234. },
  235. min: -200,
  236. max: 200,
  237. title: {
  238. text: null
  239. }
  240. },
  241. plotOptions: {
  242. solidgauge: {
  243. dataLabels: {
  244. y: 15,
  245. borderWidth: 0,
  246. useHTML: true
  247. }
  248. }
  249. },
  250. credits: {
  251. enabled: false
  252. },
  253. series: [{
  254. name: '湿度',
  255. data: [12],
  256. dataLabels: {
  257. format: '<div style="text-align:center"><span style="font-size:18px;color:' +
  258. ((Highcharts.theme && Highcharts.theme.contrastTextColor) || 'black') + '">{y}</span><br/>' +
  259. '<span style="font-size:12px;color:silver">湿度</span></div>'
  260. },
  261. tooltip: {
  262. valueSuffix: ' '
  263. }
  264. }]
  265. };
  266. options5 = {
  267. chart: {
  268. renderTo: 'container5',
  269. type: 'solidgauge',
  270. events: {
  271. click: function (event) {
  272. findSJGLDetail();
  273. }
  274. }
  275. },
  276. title: null,
  277. pane: {
  278. center: ['50%', '75%'],
  279. size: '100%',
  280. startAngle: -90,
  281. endAngle: 90,
  282. background: {
  283. backgroundColor: (Highcharts.theme && Highcharts.theme.background2) || '#EEE',
  284. innerRadius: '60%',
  285. outerRadius: '100%',
  286. shape: 'arc'
  287. }
  288. },
  289. tooltip: {
  290. enabled: false
  291. },
  292. // the value axis
  293. yAxis: {
  294. stops: [
  295. [0.1, '#55BF3B'], // green
  296. [0.5, '#DDDF0D'], // yellow
  297. [0.9, '#DF5353'] // red
  298. ],
  299. lineWidth: 0,
  300. minorTickInterval: null,
  301. tickPixelInterval: 400,
  302. tickWidth: 0,
  303. title: {
  304. y: -10
  305. },
  306. labels: {
  307. y: 0
  308. },
  309. min: 0,
  310. max: 500,
  311. title: {
  312. text: null
  313. }
  314. },
  315. plotOptions: {
  316. solidgauge: {
  317. dataLabels: {
  318. y: 15,
  319. borderWidth: 0,
  320. useHTML: true
  321. }
  322. }
  323. },
  324. credits: {
  325. enabled: false
  326. },
  327. series: [{
  328. name: '气压',
  329. data: [12],
  330. dataLabels: {
  331. format: '<div style="text-align:center"><span style="font-size:18px;color:' +
  332. ((Highcharts.theme && Highcharts.theme.contrastTextColor) || 'black') + '">{y}</span><br/>' +
  333. '<span style="font-size:12px;color:silver">气压</span></div>'
  334. },
  335. tooltip: {
  336. valueSuffix: ' '
  337. }
  338. }]
  339. };
  340. options1 = {
  341. chart: {
  342. renderTo : 'fzy1',
  343. polar: true,
  344. type: 'area'
  345. },
  346. title: {
  347. text: '',
  348. x: 0
  349. },
  350. pane: {
  351. size: '80%'
  352. },
  353. xAxis: {
  354. categories: ['北', '北北东', '北东', '东北东','东', '东南东',
  355. '南东', '南南东', '南','南南西', '南西',
  356. '西南西', '西', '西北西', '北西','北北西'
  357. ],
  358. tickmarkPlacement: 'on',
  359. lineWidth: 0
  360. },
  361. yAxis: {
  362. gridLineInterpolation: 'polygon',
  363. lineWidth: 0,
  364. min: 0
  365. },
  366. tooltip: {
  367. shared: true,
  368. pointFormat: '<span style="color:{series.color}"> <b>{point.y:,.0f}</b><br/>'
  369. },
  370. series: [{
  371. name: 'name1',
  372. data: [],
  373. pointPlacement: 'on'
  374. }]
  375. }
  376. options2 = {
  377. chart: {
  378. renderTo : 'fzy2',
  379. polar: true,
  380. type: 'area'
  381. },
  382. title: {
  383. text: '',
  384. x: 0
  385. },
  386. pane: {
  387. size: '80%'
  388. },
  389. xAxis: {
  390. categories: ['北', '北北东', '北东', '东北东','东', '东南东',
  391. '南东', '南南东', '南','南南西', '南西',
  392. '西南西', '西', '西北西', '北西','北北西'
  393. ],
  394. tickmarkPlacement: 'on',
  395. lineWidth: 0
  396. },
  397. yAxis: {
  398. gridLineInterpolation: 'polygon',
  399. lineWidth: 0,
  400. min: 0
  401. },
  402. tooltip: {
  403. shared: true,
  404. pointFormat: '<span style="color:{series.color}"> <b>{point.y:,.0f}</b><br/>'
  405. },
  406. series: [{
  407. name: 'name1',
  408. data: [],
  409. pointPlacement: 'on'
  410. }]
  411. }
  412. chart1 = new Highcharts.Chart(options1);
  413. chart2 = new Highcharts.Chart(options2);
  414. chart3 = new Highcharts.Chart(options3);
  415. chart4 = new Highcharts.Chart(options4);
  416. chart5 = new Highcharts.Chart(options5);
  417. windtowerAjax();
  418. window.setInterval(windtowerAjax, 60000);
  419. daychart();
  420. monthchart();
  421. window.setInterval(daychart, 60000);
  422. wpAllInfoAjax();
  423. window.setInterval(wpAllInfoAjax, 60000);
  424. });