var chart1;
var chart2;
var chart3;
var chart4;
var chart5;
var chart6;
var chart7;
var chart8;
var categor = ['0','1', '2', '3','4', '5', '6', '7', '8',
'9', '10', '11', '12', '13','14', '15',
'16', '17', '18','19', '20','21','22','23'];
var options1;
var options2;
var options3;
var options4;
var options5;
var options6;
var options7;
var options8;
Highcharts.setOptions({
global : {
useUTC : false
}
});
String.prototype.endWith=function(oString){
var reg=new RegExp(oString+"$");
return reg.test(this);
};
function realPowerCharBy24() {
var url = "/matrix/findRealPowerCharBy24.action";
$.ajax({
url : url,
type : "post",
cache : false,
dataType : "json",
async : false,
data : {},
ifModified : false,
success : function(result) {
var yfdl = [];
var gzdl = [];
var whdl = [];
var xddl = [];
var qfdl = [];
var sldl = [];
var fs = [];
var xtime = [];
$.each(result, function(m, obj) {
//if(m == result.length -1){
if (obj.value1 != null) {
yfdl.push( parseFloat(obj.value1) );
}
if (obj.value2 != null) {
whdl.push( parseFloat(obj.value2) );
}
if (obj.value3 != null) {
gzdl.push( parseFloat(obj.value3) );
}
if (obj.value4 != null) {
xddl.push( parseFloat(obj.value4) );
}
if (obj.value5 != null) {
qfdl.push( parseFloat(obj.value5) );
}
if (obj.value6 != null && obj.value6!=0) {
fs.push( parseFloat(obj.value6) );
}
if (obj.value7 != null ) {
sldl.push( parseFloat(obj.value7) );
}
if(obj.time!= null )
{
xtime.push(parseFloat(obj.time));
}
});
//alert(xtime.length);
options2.series[0].data = yfdl;
options2.series[1].data = gzdl;
options2.series[2].data = whdl;
options2.series[3].data = xddl;
options2.series[4].data = qfdl;
options2.series[5].data = sldl;
options2.series[6].data = fs;
options2.xAxis.categories = xtime;
chart2 = new Highcharts.Chart(options2);
}
});
}
function powercompareChat() {
var url = "/matrix/powercompareChat.action";
$.ajax({
url : url,
type : "post",
cache : false,
dataType : "json",
async : false,
data : {},
ifModified : false,
success : function(result) {
var lldl = [];
var gfdl = [];
$.each(result, function(m, obj) {
if (obj.value1 != null) {
lldl.push(obj.value1*-1-obj.value2);
}
if (obj.value2 != null) {
gfdl.push(obj.value2);
}
});
options1.series[0].data = lldl;
options1.series[1].data = gfdl;
chart1 = new Highcharts.Chart(options1);
}
});
}
function showChart() {
/***************************************************************************************************/
$.ajax( {
url : "/matrix/fdcPieChart.action",
type : "post",
cache : false,
dataType : "json",
data : {},
ifModified : false,
success : function(result) {
if (null!=result && result.length != 0) {
eval(result);
var xaixs = [];
for ( var i = 0; i < result.length; i += 1) {
var jsonObj1 = [ result[i].name, result[i].value1 ];
xaixs.push(jsonObj1);
}
options3.series[0].data = xaixs;
chart3 = new Highcharts.Chart(options3);
}
}
});
/***************************************************************************************************/
$.ajax( {
url : "/matrix/lossPieChart.action",
type : "post",
cache : false,
dataType : "json",
data : {},
ifModified : false,
success : function(result) {
if (null!=result && result.length != 0) {
eval(result);
var xaixs = [];
for ( var i = 0; i < result.length; i += 1) {
var jsonObj1 = [ result[i].name, result[i].value1 ];
xaixs.push(jsonObj1);
}
options4.series[0].data = xaixs;
chart4 = new Highcharts.Chart(options4);
}
}
});
/***************************************************************************************************/
}
function pointChart(){
$.ajax( {
url : "/matrix/pointChart.action",
type : "post",
cache : false,
dataType : "json",
data : {},
ifModified : false,
success : function(result) {
if (null!=result && result.length != 0) {
eval(result);
var xaixs = [];
var xtime = [];
for ( var i = 0; i < result.length; i += 1) {
var jsonObj1 = [result[i].name,parseFloat(result[i].value1)];
xaixs.push(jsonObj1);
xtime.push(parseFloat(result[i].time));
}
options5.series[0].data = xaixs;
options5.xAxis.categories = xtime;
//alert(options5.series[0].data);
options5.xAxis.minTickInterval=xtime.length/24;
chart5 = new Highcharts.Chart(options5);
}
}
});
}
/*************************************************************************************************/
$(document).ready(function () {
// options1 = {
// chart: {renderTo: 'chatyc',type: 'bar'},
// title: {text: ''},
// subtitle: {text: ''},
// xAxis: [{categories: categor,
// reversed: false,
// labels: {
// step: 2
// }
// }, {
// opposite: true,
// reversed: false,
// categories: categor,
// linkedTo: 0,
// labels: {
// step: 2
// }
// }],
// yAxis: {title: {
// text: null
// },
// labels: {
// formatter: function () {
// return Math.abs(this.value) + 'MWh';
// }
// }
// },
// plotOptions: {
// series: {
// stacking: 'normal'
// }
// },
// tooltip: {
// formatter: function () {
// return '' + this.series.name + ',截止上一时刻 ' + this.point.category + '时
' +
// '电量: ' + Highcharts.numberFormat(Math.abs(this.point.y), 2)+'MWh';
// }
// },
// series: [{
// name: '理论电量',
// data: []
// }, {
// name: '实发电量',
// data: []
// }]
// };
options1 = {
chart: {renderTo: 'chatyc',type: 'bar'},
title: {text: ''},
subtitle: {text: ''},
xAxis: [{categories: categor,
reversed: false,
//linkedTo: 0,
labels: {
step: 2
}
}
, {
opposite: true,
reversed: false,
//categories: categor,
//linkedTo: 0,
labels: {
step: 2
}
}
],
yAxis: {title: {
text: null
},
min: 0,
labels: {
formatter: function () {
return Math.abs(this.value) + 'MWh';
}
}
},
plotOptions: {
series: {
stacking: 'normal'
}
},
tooltip: {
formatter: function () {
console.log(this.series);
var html = '' + this.series.name + ',截止上一时刻 ' + this.point.category + '时
';
if(this.series.name=='理论电量'){
html +='电量: ' + Highcharts.numberFormat(Math.abs(this.point.total), 2)+'MWh';
}else{
html +='电量: ' + Highcharts.numberFormat(Math.abs(this.point.y), 2)+'MWh';
}
return html;
}
},
series: [{
name: '理论电量',
data: []
}, {
name: '实发电量',
data: []
}]
};
/*************************************************/
options2 = {
colors: [
'#0BFEFA', //发电量
'#FD0100',//检修
'#FF7B16', //故障
'#D201D8',//限电
'#8085E9', //性能
'#A6A6A6', //受累
'#000000'//风速
],
chart: {
renderTo: 'glqx_Chart',
type: 'column',
//backgroundColor:'#BFDFFF',
//plotBackgroundColor:'#BFDFFF',
zoomType: 'x'
},title:null ,
xAxis: {
type: 'datetime',
labels: {
align: 'center',
formatter: function() {
return Highcharts.dateFormat('%H
%M', this.value);
}
}
},
yAxis: [{ // Primary yAxis
labels: {
format: '{value}万kw',
style: {
color: '#89A54E'
}
},
title: {
text: '电量',
style: {
color: '#89A54E'
}
}
}, { // Secondary yAxis
title: {
text: '风速',
style: {
color: '#4572A7'
}
},
labels: {
format: '{value} m/s',
style: {
color: '#4572A7'
}
},
opposite: true
}],
legend: {
layout: 'vertical',
// backgroundColor: '#FFFFFF',
align: 'right',
verticalAlign: 'top',
x:-80,
floating: true
// shadow: true
// layout: 'vertical',
// align: 'right',
// verticalAlign: 'middle',
// borderWidth: 0
},
tooltip: {
shared:true,
xDateFormat:'%Y-%m-%d %H:%M'
/*formatter: function() {
return ''+ this.series.name +':'+
Highcharts.numberFormat(this.y, 2) +' 万kW
时间:'+
Highcharts.dateFormat('%Y-%m-%d %H:%M:%S', this.x);
}*/
},
series: [{
name: '日发电量(单位:万KWh)',
yAxis:0
},
{name: '故障损失电量(单位:万KWh)',
yAxis:0
},{
name: '检修损失电量(单位:万KWh)',
yAxis:0
},{
name: '限电损失电量(单位:万KWh)',
yAxis:0
}
,{
name: '性能损失电量(单位:万KWh)',
yAxis:0
},{
name: '受累损失电量(单位:万KWh)',
yAxis:0
},{
name: '风速(单位:m/s)',
yAxis:1,
type: 'spline'
}]
};
/***************************************************************************************************/
options3 = {
chart : {
renderTo : 'dltj_Chart_1',
plotBackgroundColor : null,
plotBorderWidth : null,
plotShadow : false
},
title : {
text : '发电量占比'
},
tooltip : {
pointFormat : '{series.name}: {point.percentage:.1f}%'
},
plotOptions : {
pie : {
allowPointSelect : true,
cursor : 'pointer',
dataLabels : {
enabled : false,
color : '#000000',
connectorColor : '#000000',
format : '{point.name}: {point.percentage:.1f} %'
},
showInLegend : true
}
},
legend : {
layout : 'vertical',
align : 'right',
verticalAlign : 'bottom',
borderWidth : 0
},
series : [ {
type : 'pie',
name : '占比',
data : []
} ]
};
/***************************************************************************************************/
options4 = {
colors: [
'#8085E9', //性能
'#FD0100',//检修
'#FF7B16', //故障
'#D201D8',//限电
'#00ff20' //受累
],
chart : {
renderTo : 'dltj_Chart_2',
plotBackgroundColor : null,
plotBorderWidth : null,
plotShadow : false
},
title : {
text : '损失电量占比'
},
tooltip : {
pointFormat : '{series.name}: {point.percentage:.1f}%'
},
plotOptions : {
pie : {
allowPointSelect : true,
cursor : 'pointer',
dataLabels : {
enabled : false,
color : '#000000',
connectorColor : '#000000',
format : '{point.name}: {point.percentage:.1f} %'
},
showInLegend : true
}
},
legend : {
layout : 'vertical',
align : 'right',
verticalAlign : 'bottom',
borderWidth : 0
},
series : [ {
type : 'pie',
name : '占比',
data : []
} ]
};
/***************************************************************/
options5 = {
chart: {
renderTo: 'pointChat',
type: 'scatter',
zoomType: 'xy'
},
title: {
text: ''
},
xAxis: {
type: 'datetime',
labels: {
align: 'center',
formatter: function() {
return Highcharts.dateFormat('%H:%M', this.value);
}
},
showLastLabel: true
},
yAxis: {
title: {
text: '功率 (MW)'
}
},
legend: {
layout: 'vertical',
align: 'left',
verticalAlign: 'top',
x: 100,
y: 70,
floating: true,
backgroundColor: (Highcharts.theme && Highcharts.theme.legendBackgroundColor) || '#FFFFFF',
borderWidth: 1
},
plotOptions: {
scatter: {
marker: {
radius: 2,
states: {
hover: {
enabled: true,
lineColor: 'rgb(100,100,100)'
}
}
},
states: {
hover: {
marker: {
enabled: false
}
}
},
tooltip: {
shared:true,
xDateFormat:'%H:%M',
pointFormat : '{point.name}
实际出力{point.y} MW'
}
}
},
series: [{
name: '山西新能源',
color: 'rgba(119, 152, 191, .5)',
turboThreshold:1500,
data: []
}]
};
/*******************************************************************/
options6 = {
chart: {
renderTo: 'speedCL',
type: 'solidgauge'
},
title: null,
pane: {
center: ['50%', '85%'],
size: '170%',
startAngle: -90,
endAngle: 90,
background: {
backgroundColor: (Highcharts.theme && Highcharts.theme.background2) || '#EEE',
innerRadius: '60%',
outerRadius: '100%',
shape: 'arc'
}
},
tooltip: {
enabled: false
},
// the value axis
yAxis: {
stops: [
[0.1, '#55BF3B'], // green
[0.5, '#DDDF0D'], // yellow
[0.9, '#DF5353'] // red
],
lineWidth: 0,
minorTickInterval: null,
tickPixelInterval: 400,
tickWidth: 0,
min: 0,
max: 25,
title: {
y: 7,
text: ''
},
labels: {
y: 16
}
},
plotOptions: {
solidgauge: {
dataLabels: {
y: 22,
borderWidth: 0,
useHTML: true
}
}
},
credits: {
enabled: false
},series: [{
name: '风速',
data: [6.66],
dataLabels: {
format: '