$(function() { BWA.ChartOptions = BWA.ChartOptions || {}; var C = BWA.ChartOptions.LocEnergyConsumption = BWA.ChartOptions.LocEnergyConsumption || {}; var valueAxises = [ { pane: 'topPane', title: { text: '전력 사용량 (kwh)', } }, /* { //visible:false, pane: 'topPane', name: 'Temperature', position: 'right', //valueMarginsEnabled: true, //minValueMargin: 0, //maxValueMargin: 0, min: -20, max: 40, title: { text: $G('outdoorTemperatureWithUnit') } }, { pane: 'topPane', name: 'humidity', min: 0, max: 100, position: 'right', grid: { visible: true }, label: { visible: true, format: 'largeNumber' }, title: { text: $G('outdoorHumidityWithUnit') }, }*/ ]; var argumentAxisS = [ { argumentType: 'datetime', title: $G('hour'), label: { alignment: 'center', format: 'HH' }, tickInterval: { hours: 1 }, }, { argumentType: 'datetime', title: $G('hour'), label: { alignment: 'center', format: 'HH' }, tickInterval: { hours: 1 }, }, { argumentType: 'datetime', title: $G('day'), label: { alignment: 'center', format: 'MM-dd' }, tickInterval: { days: 1 }, }, { argumentType: 'datetime', title: $G('month'), label: { alignment: 'center', format: 'MM' }, tickInterval: { months: 1 }, }] var fuelTypeValueAxises = [{ pane: 'topPane', title: { text: $G('electricityConsumptionUsageWithUnit') } }, /*{ pane: 'topPane', title: { text: $G('gasUsageWithUnit') } }, { pane: 'topPane', title: { text: $G('waterUsageWithUnit') } }*/]; var series = [{ type: 'line', pane: 'topPane', axis: 'Temperature', valueField: 'Temperature', visible: true, // 시리즈만 안보이게 할수 있다. 대신 그렇게 할려면 시작은 false로 해야 한다 hcLee 2015 04 25 point: { size: 8 }, name: $G('outdoorTemperature'), label: { visible: false, customizeText: function() { return this.valueText + ' °C'; } } }, { type: 'line', pane: 'topPane', axis: 'humidity', valueField: 'Humidity', point: { size: 8 }, name: $G('outdoorHumidity'), label: { visible: false, customizeText: function() { return this.valueText + ' %'; } } }]; var fuelTypeSeries = [{ type: 'bar', pane: 'topPane', valueField: 'Value', name: '전력 사용량', label: { horizontalAlignment: 'left', visible: false, customizeText: function() { return this.valueText + 'kWh'; } } }/*, { type: 'bar', pane: 'topPane', valueField: 'Value', name: '가스', label: { visible: false, customizeText: function() { return this.valueText + 'm3'; } } }, { type: 'bar', pane: 'topPane', valueField: 'Value', name: '수도', label: { visible: false, customizeText: function() { return this.valueText + 'm3'; } } }*/]; //C.getSeriesOptions = function(fuelTypeId, goalUpperBound) { C.getSeriesOptions = function (codeTimeType, goalUpperBound) { return { legend: { visible: true, verticalAlignment: 'top', horizontalAlignment: 'center' }, /* valueAxis: [$.extend({}, fuelTypeValueAxises[fuelTypeId - 1], { constantLines: [{ label: { text: $G('goalUpperBound') }, width: 2, value: goalUpperBound, color: '#ff4500', dashStyle: 'dash' }], showZero: true, //})].concat(valueAxises[0]), })].concat(valueAxises), */ panes: [{ name: 'topPane', border: { visible: false, left: false, right: false, top: false, color: 'gray' } }, ], defaultPane: "topPane", commonSeriesSettings: { argumentField: "DateTime", selectionStyle: { hatching: { direction: "left" } } }, //argumentAxis: BWA.Chart.getTimeLineArgumentAxis(moment(), codeTimeType), argumentAxis: BWA.Chart.getTimeLineArgumentAxis(null, codeTimeType), //argumentAxis: argumentAxisS[codeTimeType-1], valueAxis: valueAxises, //series: [fuelTypeSeries[fuelTypeId - 1]].concat(series[0]), series: { type: 'bar', pane: 'topPane', valueField: 'Value', name: '전력 사용량', label: { horizontalAlignment: 'left', visible: false, customizeText: function() { return this.valueText + 'kWh'; } } } }; }; //사용안함 C.getChartOptions = function(codeTimeType, goalUpperBound) { return { legend: { visible: true, verticalAlignment: 'top', horizontalAlignment: 'center' }, legendClick: function (clickedItem) { var chart = $('#chart').dxChart('instance'); var series = chart.getSeriesByName(clickedItem.name); var chartOptions = chart.option(); if (series.isVisible()) { var valueAxis = []; valueAxis.push(chartOptions.valueAxis[0]); valueAxis.push(valueAxises[1]); chart.option('valueAxis', valueAxis); var seriesNew = []; seriesNew.push(chartOptions.series[0]); seriesNew.push(series[1]); chart.option('series', seriesNew); } else { var valueAxis = []; valueAxis.push(chartOptions.valueAxis[0]); valueAxis.push(valueAxises[0]); valueAxis.push(valueAxises[1]); chart.option('valueAxis', valueAxis); } }, argumentAxis: BWA.Chart.getTimeLineArgumentAxis(moment(), codeTimeType), commonSeriesSettings: { argumentField: "DateTime", selectionStyle: { hatching: { direction: "left" } } }, panes: [{ name: 'topPane', border: { visible: false, left: false, right: false, top: false, color: 'gray' } },], defaultPane: "topPane", customizePoint: function() { if (this.value > goalUpperBound()) { return { color: '#ff4500', hoverStyle: { color: '#ff4500' } }; } }, tooltip: { enabled: true, shared: true // format: "millions", //customizeText: function() { // return this.argumentText + "
" + this.valueText; //} }, }; }; });