$(function () {
BWA.ChartOptions = BWA.ChartOptions || {};
var C = BWA.ChartOptions.FmsEnergy = BWA.ChartOptions.FmsEnergy || {};
var valueAxises = [
{
name: 've',
title: {
text: $G('electricityUsageWithUnit')
}
}, {
name: 'vg',
title: {
text: $G('gasUsageWithUnit')
}
}, {
name: 'vw',
title: {
text: $G('waterUsageWithUnit')
}
}, {
name: 'vco2',
title: {
text: $G('co2WithUnit')
}
}, {
name: 'vco2Last',
position: 'right',
title: {
text: '작년 CO2 발생량'
}
}
];
var seriesS = [
{
type: 'bar',
valueField: 'Value',
axis: 've',
name: $G('electricityUsage'),
label: {
visible: false,
customizeText: function () {
return this.valueText + 'kWh';
}
}
}, {
type: 'bar',
valueField: 'Value',
axis: 'vg',
name: $G('gasUsage'),
label: {
visible: false,
customizeText: function () {
return this.valueText + 'm3';
}
}
}, {
type: 'bar',
valueField: 'Value',
axis: 'vw',
name: $G('waterUsage'),
label: {
visible: false,
customizeText: function () {
return this.valueText + 'm3';
}
}
},
[
{
type: 'stackedBar',
valueField: 'ECo2',
axis: 'vco2',
name: $G('electricityCo2'),
label: {
visible: false,
customizeText: function () {
return this.valueText + 'kgCO2';
}
}
}, {
type: 'stackedBar',
axis: 'vco2',
valueField: 'GCo2',
name: $G('gasCo2'),
label: {
visible: false,
customizeText: function () {
return this.valueText + 'kgCO2';
}
}
}
],
[
{
type: 'stackedBar',
valueField: 'ECo2Last',
name: '전년 전력 CO2',
label: {
visible: false,
customizeText: function () {
return this.valueText + 'kgCO2';
}
}
}, {
type: 'stackedBar',
valueField: 'GCo2Last',
name: '전년 가스 CO2',
label: {
visible: false,
customizeText: function () {
return this.valueText + 'kgCO2';
}
}
}
]
];
var seriesLastYear = [
{
type: 'bar',
axis: 've',
valueField: 'ValueLast',
name: '전년 전력 사용량',
label: {
visible: false,
customizeText: function () {
return this.valueText + 'kWh';
}
}
}, {
type: 'bar',
axis: 'vg',
valueField: 'ValueLast',
name: '전년 가스 사용량',
label: {
visible: false,
customizeText: function () {
return this.valueText + 'm3';
}
}
}, {
type: 'bar',
axis: 'vw',
valueField: 'ValueLast',
name: '전년 수도 사용량',
label: {
visible: false,
customizeText: function () {
return this.valueText + 'm3';
}
}
},
[
{
type: 'stackedBar',
axis: 'vco2',
valueField: 'ECo2Last',
name: '전년 전력 CO2',
label: {
visible: false,
customizeText: function () {
return this.valueText + 'kgCO2';
}
}
}, {
type: 'stackedBar',
axis: 'vco2',
valueField: 'GCo2Last',
name: '전년 가스 CO2',
label: {
visible: false,
customizeText: function () {
return this.valueText + 'kgCO2';
}
}
}
]
];
C.getSeriesOptions = function (fuelTypeId, timeTypeId, MS, ME) {
return {
valueAxis: valueAxises[fuelTypeId - 1],
commonSeriesSettings: {
argumentField: "DateTime",
selectionStyle: {
hatching: {
direction: "left"
}
}
},
series: (fuelTypeId > 3) ? seriesS[fuelTypeId - 1].concat(seriesS[fuelTypeId - 1]) : [seriesS[fuelTypeId - 1]]
//series: (fuelTypeId > 3) ? seriesS[fuelTypeId - 1].concat(seriesS[fuelTypeId - 1]) : [seriesS[fuelTypeId - 1]].concat(seriesLastYear[fuelTypeId - 1])
};
};
C.getChartOptions = function (codeTimeType) {
return {
palette: 'Bright',
legend: {
visible: true,
verticalAlignment: 'top',
horizontalAlignment: 'center'
},
commonSeriesSettings: {
argumentField: "DateTime",
selectionStyle: {
hatching: {
direction: "left"
}
}
},
valueAxis: [{
title: {
text: $G('electricityConsumptionUsageWithUnit')
}
}],
series: seriesS[0],
tooltip: {
enabled: true,
format: 'fixedPoint',
precision: 2,
argumentFormat: 'shortDate',
customizeText: function () {
return this.argumentText + "
" + "
" + this.valueText;
}
},
crosshair: {
enabled: true,
width: 2,
horizontalLine: {
color: 'red',
dashStyle: 'dash',
visible: false
},
verticalLine: {
color: 'red',
dashStyle: 'dash',
visible: true
},
label: {
visible: true,
backgroundColor: "#949494",
font: {
color: "#fff",
size: 12,
}
}
}
};
};
});