123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340 |
- var chartfc;
- var chartgf;
- var optionsfc;
- var optionsgf;
- Highcharts.setOptions({
- global : {
- useUTC : false
- }
- });
- optionsfc = {
- colors: [
-
- '#19FF38',
- '#0026FF',
- '#FF350C'
- ],
- chart: {
- renderTo: 'chartfc',
- type: 'spline',
- //backgroundColor:'#BFDFFF',
- //plotBackgroundColor:'#BFDFFF',
- zoomType: 'x',
- events: {
-
- }
- },
- title: {
- text: '风场实时功率'
- },
- subtitle: {
- text: ''
- },
- xAxis: {
- labels: {
- align: 'center',
- formatter: function() {
- return Highcharts.dateFormat('%H<br/>%M', this.value);
- }
- },
- type: 'datetime'
- },
- yAxis: [{
- title: {
- text: '功率(MW)'
- }
- }],
- legend: {
- layout: 'vertical',
- // backgroundColor: '#FFFFFF',
- align: 'left',
- verticalAlign: 'top',
- floating: true
- // shadow: true
- // layout: 'vertical',
- // align: 'right',
- // verticalAlign: 'middle',
- // borderWidth: 0
- },
- tooltip: {
-
- shared:true,
- xDateFormat:'%Y-%m-%d %H:%M '
- /*formatter: function() {
- return '<b>'+ this.series.name +'</b>:'+
- Highcharts.numberFormat(this.y, 2) +' 万kW<br/>时间:'+
- Highcharts.dateFormat('%Y-%m-%d %H:%M:%S', this.x);
- }*/
- },
- credits: {
- enabled: false
- },
- plotOptions: {
- spline: {
- dataLabels : {
- enabled :false
- },
- // pointPadding: 0.2,
- borderWidth: 0
- },
- column: {
- pointPadding: 0.2,
- borderWidth: 0
- },
- series: {
- cursor: 'pointer',
- marker: {
- radius: 0,
- symbol: 'circle' //曲线点类型:"circle", "square", "diamond", "triangle","triangle-down",默认是"circle"
- }
- }
- },
- series: [{
-
- name: '预测功率(MW)',
- yAxis:0
- },
- {
-
- name: '实际功率(MW)',
- yAxis:0
- },{
-
- name: '应发功率(MW)',
- yAxis:0
- }]
- };
- optionsgf = {
- colors: [
-
- '#19FF38',
- '#0026FF',
- '#FF350C'
- ],
- chart: {
- renderTo: 'chartgf',
- type: 'spline',
- //backgroundColor:'#BFDFFF',
- //plotBackgroundColor:'#BFDFFF',
- zoomType: 'x',
- events: {
-
- }
- },
- title: {
- text: '电站实时功率'
- },
- subtitle: {
- text: ''
- },
- xAxis: {
- labels: {
- align: 'center',
- formatter: function() {
- return Highcharts.dateFormat('%H<br/>%M', this.value);
- }
- },
- type: 'datetime'
- },
- yAxis: [{
- title: {
- text: '功率(MW)'
- }
- }],
- legend: {
- layout: 'vertical',
- // backgroundColor: '#FFFFFF',
- align: 'left',
- verticalAlign: 'top',
- floating: true
- // shadow: true
- // layout: 'vertical',
- // align: 'right',
- // verticalAlign: 'middle',
- // borderWidth: 0
- },
- tooltip: {
-
- shared:true,
- xDateFormat:'%Y-%m-%d %H:%M '
- /*formatter: function() {
- return '<b>'+ this.series.name +'</b>:'+
- Highcharts.numberFormat(this.y, 2) +' 万kW<br/>时间:'+
- Highcharts.dateFormat('%Y-%m-%d %H:%M:%S', this.x);
- }*/
- },
- credits: {
- enabled: false
- },
- plotOptions: {
- spline: {
- dataLabels : {
- enabled :false
- },
- // pointPadding: 0.2,
- borderWidth: 0
- },
- column: {
- pointPadding: 0.2,
- borderWidth: 0
- },
- series: {
- cursor: 'pointer',
- marker: {
- radius: 0,
- symbol: 'circle' //曲线点类型:"circle", "square", "diamond", "triangle","triangle-down",默认是"circle"
- }
- }
- },
- series: [{
-
- name: '预测功率(MW)',
- yAxis:0
- },
- {
-
- name: '实际功率(MW)',
- yAxis:0
- },{
-
- name: '应发功率(MW)',
- yAxis:0
- }]
- };
- $(document).ready(
- function(){
- chartfc=new Highcharts.Chart(optionsfc);
- chartgf=new Highcharts.Chart(optionsgf);
- realfc();
- realgf();
- window.setInterval(realfc,60000);
- window.setInterval(realgf,80000);
- }
- );
- function realfc(){
- $.ajax({
- url : 'realFcAjax.action',
- type : "post",
- cache : false,
- dataType : "json",
- data : {},
- ifModified : false,
- success : function(result) {
- var ycgl = [];
- var sjgl = [];
- var pjfs = [];
- var xtime = [];
- var index=0;
- var count=0;
- $.each(result, function(m, obj) {
- //if(m == result.length -1){
-
- if(index<obj.value4){
- index++;
- ycgl.push( parseFloat(obj.value1) );
-
- xtime.push(parseFloat(obj.time));
- }
- if(count<obj.value5){
- sjgl.push( parseFloat(obj.value2) );
- pjfs.push( parseFloat(obj.value3) );
- count++;
- }
-
- });
-
- if (chartfc) {
- //chart.redraw();
- chartfc.series[0].setData(ycgl);
- chartfc.series[1].setData(sjgl);
- chartfc.series[2].setData(pjfs);
- //chart.series[3].setData(cftfs);
-
- //optionsfc.xAxis.categories = xtime;
- if(chartfc.xAxis[0]){
- chartfc.xAxis[0].setCategories(xtime);
- }
- else{
- chartfc.addAxis({categories:xtime},true);
- }
-
- } else {
- optionsfc.series[0].data = ycgl;
- optionsfc.series[1].data = sjgl;
- optionsfc.series[2].data = pjfs;
- optionsfc.xAxis.categories = xtime;
- chartfc = new Highcharts.Chart(optionsfc);
- }
- }
- });
- }
- function realgf(){$.ajax({
- url : 'realGfAjax.action',
- type : "post",
- cache : false,
- dataType : "json",
- data : {},
- ifModified : false,
- success : function(result) {
- var ycgl = [];
- var sjgl = [];
- var pjfs = [];
- var xtime = [];
- var index=0;
- var count=0;
- $.each(result, function(m, obj) {
- //if(m == result.length -1){
-
- if(index<obj.value4){
- index++;
- ycgl.push( parseFloat(obj.value1) );
-
- xtime.push(parseFloat(obj.time));
- }
- if(count<obj.value5){
- sjgl.push( parseFloat(obj.value2) );
- pjfs.push( parseFloat(obj.value3) );
- count++;
- }
-
- });
- if (chartgf) {
- //chart.redraw();
- chartgf.series[0].setData(ycgl);
- chartgf.series[1].setData(sjgl);
- chartgf.series[2].setData(pjfs);
- //chart.series[3].setData(cftfs);
-
- // optionsgf.xAxis.categories = xtime;
- if(chartgf.xAxis[0]){
- chartgf.xAxis[0].setCategories(xtime);
- }
- else{
- chartgf.addAxis({categories:xtime},true);
- }
-
-
- } else {
- optionsgf.series[0].data = ycgl;
- optionsgf.series[1].data = sjgl;
- optionsgf.series[2].data = pjfs;
- optionsgf.xAxis.categories = xtime;
- chartgf = new Highcharts.Chart(optionsgf);
- }
- }
- });
- }
|