$(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', axis: 'vco2', valueField: 'WCo2', name: $G('waterCo2'), label: { visible: false, customizeText: function() { return this.valueText + 'kgCO2'; } } }*/], [{ type: 'stackedBar', //axis: 'vco2Last', //2015 07 06 이렇게 같은 축으로 명시해버리면 합쳐서 그려버린다. 다른 시리즈로 나타낼려면 축을 다르게 주거나 이렇게 해야 한다. hcLee //color: 'green', 이렇게 색상을 맞추면 됨. 2015 07 06 valueField: 'ECo2Last', name: '전년 전력 CO2', label: { visible: false, customizeText: function () { return this.valueText + 'kgCO2'; } } }, { type: 'stackedBar', //axis: 'vco2Last', //2015 07 06 이렇게 같은 축으로 명시해버리면 합쳐서 그려버린다. 다른 시리즈로 나타낼려면 축을 다르게 주거나 이렇게 해야 한다. hcLee valueField: 'GCo2Last', name: '전년 가스 CO2', label: { visible: false, customizeText: function () { return this.valueText + 'kgCO2'; } } }/*, { type: 'stackedBar', //axis: 'vco2Last', //2015 07 06 이렇게 같은 축으로 명시해버리면 합쳐서 그려버린다. 다른 시리즈로 나타낼려면 축을 다르게 주거나 이렇게 해야 한다. hcLee valueField: 'WCo2Last', 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'; } } }/*, { type: 'stackedBar', axis: 'vco2', valueField: 'WCo2Last', name: '전년 수도 CO2', label: { visible: false, customizeText: function () { return this.valueText + 'kgCO2'; } } }*/] ]; C.getSeriesOptions = function (fuelTypeId, timeTypeId, MS, ME) { return { //valueAxis: (fuelTypeId > 3) ? [valueAxises[fuelTypeId - 1]].concat(valueAxises[fuelTypeId]) : valueAxises[fuelTypeId - 1], valueAxis: valueAxises[fuelTypeId - 1], //argumentAxis: BWA.Chart.getTimeLineArgumentAxis(null, timeTypeId, MS, ME), commonSeriesSettings: { argumentField: "DateTime", selectionStyle: { hatching: { direction: "left" } } }, series: (fuelTypeId > 3) ? seriesS[fuelTypeId - 1].concat(seriesS[fuelTypeId - 1]) : [seriesS[fuelTypeId - 1]].concat(seriesLastYear[fuelTypeId - 1]) //series: (fuelTypeId > 3) ? (seriesS[fuelTypeId - 1]).concat(seriesLastYear[fuelTypeId - 1]) : [seriesS[fuelTypeId - 1]].concat(seriesLastYear[fuelTypeId - 1]) //series: series[fuelTypeId - 1].concat(seriesLastYear[fuelTypeId - 1]) }; }; C.getChartOptions = function (codeTimeType) { return { palette: 'Bright', legend: { visible: true, verticalAlignment: 'top', horizontalAlignment: 'center' }, //argumentAxis: BWA.Chart.getTimeLineArgumentAxis(null, codeTimeType), 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, } } } }; }; });