123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220 |
- $(function () {
- BWA.ChartOptions = BWA.ChartOptions || {};
- BWA.ChartOptions.ToeEnergyUsage = {
- getPieChartDayOptions: function () {
- return _.extend({
- palette: "Pastel",
- }, BWA.ChartOptions.ToeEnergyUsage.getPieChartOptions());
- },
- getPieChartMonthOptions: function () {
- return _.extend({
- palette: "Pastel",
- }, BWA.ChartOptions.ToeEnergyUsage.getPieChartOptions());
- },
- getBarChartDayOptions: function () {
- return _.extend({
- palette: "Pastel",
- }, BWA.ChartOptions.ToeEnergyUsage.getBarChartOptions($Code.TimeType.DAY));
- },
- getBarChartMonthOptions: function (handlePointClick) {
- return _.extend({
- palette: "Pastel",
- }, BWA.ChartOptions.ToeEnergyUsage.getBarChartOptions($Code.TimeType.MONTH, handlePointClick));
- },
- getPieChartOptions: function () {
- return {
- legend: {
- horizontalAlignment: "right",
- verticalAlignment: "top",
- margin: 10,
- border: {
- visible: true
- }
- },
- tooltip: {
- enabled: true,
- format: 'fixedPoint',
- precision: 1,
- customizeTooltip: function (point) {
- return {
- text: [this.argumentText, ': ', this.valueText].join('')
- };
- }
- },
- series: [
- {
- type: "doughnut", // if not, pie.
- argumentField: "FuelTypeName",
- argumentType: "string",
- valueField: "Value",
- hoverStyle: {
- color: "#ffd700"
- },
- label: {
- visible: true,
- connector: {
- visible: true
- },
- customizeText: function (pointInfo) {
- //return pointInfo.argumentText;
- return pointInfo.percentText; //
- }
- }
- }
- ]
- };
- },
- getBarChartOptions: function (codeTimeType, handlePointClick) {
- var argumentAxis;
- switch (codeTimeType) {
- case $Code.TimeType.DAY:
- //argumentAxis.argumentType = 'string';
- //argumentAxis = {
- // label: {
- // customizeText: function () {
- // return this.value + '일';
- // }
- // },
- // tickInterval: 5,
- //};
- break;
- case $Code.TimeType.MONTH:
- /*
- argumentAxis = {
- label: {
- customizeText: function() {
- return this.value + '월';
- }
- },
- //min: 1,
- //max: 12,
- //valueMarginsEnabled: false,
- //tickInterval: 1,
- //minValueMargin: 0.0,
- //maxValueMargin: 0.02,
- };*/
- break;
- }
- //argumentAxis.argumentType = 'string';
- return {
- pointClick: handlePointClick,
- legend: {
- visible: false,
- verticalAlignment: 'center',
- horizontalAlignment: 'right',
- border: {
- visible: true
- }
- },
- animation: {
- enabled: true
- },
- argumentAxis: argumentAxis,
- commonSeriesSettings: {
- type: 'stackedBar',
- argumentField: 'DateTime',
- selectionStyle: {
- hatching: {
- direction: "left"
- }
- },
- //label: {
- // visible: true,
- // format: 'fixedPoint',
- // precision: 0,
- //}
- },
- valueAxis: [{
- label: {
- //format: 'thousands'
- //precision: 2
- },
- title: {
- text: 'TOE'
- }
- }],
- series: [{
- valueField: 'ElectricityToe',
- name: $G('electricity'),
- label: {
- //visible: true,
- //format: 'fixedPoint',
- //precision: 2,
- //customizeText: function() {
- // return this.valueText + 'TOE';
- //}
- }
- }, {
- //type: 'stackedBar',
- //type: 'bar',
- valueField: 'GasToe',
- name: $G('gas'),
- label: {
- //visible: true,
- //format: 'fixedPoint',
- //precision: 2,
- //customizeText: function() {
- // return this.valueText + 'TOE';
- //}
- }
- }, {
- //type: 'stackedBar',
- valueField: 'WaterToe',
- name: $G('water'),
- //label: {
- // visible: false,
- // customizeText: function() {
- // return this.valueText + 'TOE';
- // }
- //}
- }],
- tooltip: {
- enabled: true,
- format: 'fixedPoint',
- precision: 2,
- customizeTooltip: function (point) {
- return {
- text: [this.valueText].join('')
- };
- }
- },
- crosshair: {
- enabled: false,
- width: 2,
- horizontalLine: {
- //color: 'skyblue',
- dashStyle: 'dash',
- visible: false
- },
- verticalLine: {
- //color: 'limegreen',
- dashStyle: 'dash'
- },
- label: {
- visible: true,
- backgroundColor: "#949494",
- font: {
- color: "#fff",
- size: 12,
- }
- }
- }
- };
- },
- };
- });
|