$(function () {
BWA.ChartOptions = BWA.ChartOptions || {};
var C = BWA.ChartOptions.RealtimeEnergyConsumption = BWA.ChartOptions.RealtimeEnergyConsumption || {};
var valueAxises = [{
pane: 'topPane',
name: 'Temperature',
position: 'right',
tick: {
visible: false,
},
grid: {
visible: false,
},
type: 'continuous',
valueType: 'numeric',
tickInterval: 3,
minValueMargin: 0,
maxValueMargin: 0,
valueMarginsEnabled: true,
title: {
text: $G('outdoorTemperatureWithUnit')
}
},
{
pane: 'topPane',
name: 'humidity',
position: 'right',
type: 'continuous',
valueType: 'numeric',
tick: {
visible: false,
},
grid: {
visible: false,
},
tickInterval: 5,
minValueMargin: 0,
maxValueMargin: 0,
valueMarginsEnabled: true,
title: {
text: $G('outdoorHumidityWithUnit')
},
}];
var fuelTypeValueAxises = [{
pane: 'topPane',
title: {
text: $G('electricityUsageWithUnit')
},
grid: {
visible: true,
},
}, {
pane: 'topPane',
title: {
text: $G('gasUsageWithUnit')
}
}, {
pane: 'topPane',
title: {
text: $G('waterUsageWithUnit')
}
}];
var series = [{
type: 'spline',
pane: 'topPane',
axis: 'Temperature',
valueField: 'Temperature',
visible: true, // 시리즈만 안보이게 할수 있다. 대신 그렇게 할려면 시작은 false로 해야 한다 hcLee 2015 04 25
point: { size: 8 },
color: 'red',
name: $G('outdoorTemperature'),
label: {
visible: false,
customizeText: function () {
return this.valueText + ' °C';
}
}
}, {
type: 'spline',
pane: 'topPane',
axis: 'humidity',
valueField: 'Humidity',
color: 'blue',
point: { size: 8 },
name: $G('outdoorHumidity'),
label: {
visible: false,
customizeText: function () {
return this.valueText + ' %';
}
}
}];
var fuelTypeSeries = [{
type: 'bar',
pane: 'topPane',
valueField: 'Value',
name: $G('elec'),
label: {
horizontalAlignment: 'left',
visible: false,
customizeText: function () {
return this.valueText + 'kWh';
}
}
}, {
type: 'bar',
pane: 'topPane',
valueField: 'Value',
name: $G('gas'),
label: {
visible: false,
customizeText: function () {
return this.valueText + 'm3';
}
}
}, {
type: 'bar',
pane: 'topPane',
valueField: 'Value',
name: $G('water'),
label: {
visible: false,
customizeText: function () {
return this.valueText + '㎥';
}
}
}];
C.getSeriesOptions = function (fuelTypeId, goalUpperBound) {
return {
palette: 'Ocean',
valueAxis: [$.extend({}, fuelTypeValueAxises[fuelTypeId - 1], {
showZero: true,
})].concat(valueAxises),
series: [fuelTypeSeries[fuelTypeId - 1]].concat(series),
argumentAxis: BWA.Chart.getTimeLineArgumentAxis(moment(), $Code.TimeType.QUARTERMIN),
};
};
C.getChartOptions = function (codeTimeType, goalUpperBound) {
return {
legend: {
visible: true,
verticalAlignment: 'top',
horizontalAlignment: 'center',
},
argumentAxis: BWA.Chart.getTimeLineArgumentAxis(moment(), codeTimeType),
commonSeriesSettings: {
argumentField: "DateTime",
selectionStyle: {
hatching: {
direction: "right"
}
}
},
panes: [{
name: 'topPane',
border: {
visible: false,
left: false,
right: false,
top: false,
color: 'gray'
}
}, ],
defaultPane: "topPane",
customizePoint: function () {
},
tooltip: {
enabled: true,
format: 'fixedPoint',
precision: 2,
shared: true,
argumentFormat: 'shortDate',
customizeTooltip: function (point) {
return {
text: "[" + point.argument.format("hh시 mm분") + "]" + "
" + "
" + point.valueText
};
}
},
crosshair: {
enabled: true,
width: 2,
horizontalLine: {
dashStyle: 'dash',
visible: false
},
verticalLine: {
dashStyle: 'dash'
},
label: {
visible: true,
backgroundColor: "#949494",
font: {
color: "#fff",
size: 12,
}
}
}
};
};
});