-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathEnergyUsage.js
executable file
·213 lines (184 loc) · 10.5 KB
/
EnergyUsage.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
(function () {
"use strict";
var graphMenuSelection = document.getElementById('graph-type');
function setup() {
$('#clickViewDescription').click(function () {
$(this).text(function(i, text) {
return text === "Click to view description" ? "Click to hide description" : "Click to view description";
});
$('#description_img').toggle();
});
$('#changeGraphType').click(function (){
document.getElementById("graph_img").style.display = 'none';
document.getElementById("chart1").style.display = 'none';
document.getElementById("chart2").style.display = 'none';
var graph = $('#graph-type').val();
if (graph == '1') {
console.log("graph-type1: "+graph)
document.getElementById("selection").style.display = '';
document.getElementById("selection_bar").style.display = 'none';
document.getElementById("selection_tree").style.display = 'none';
} else if (graph == '2') {
console.log("graph-type2: "+graph)
document.getElementById("selection").style.display = 'none';
document.getElementById("selection_bar").style.display = 'none';
document.getElementById("selection_tree").style.display = 'none';
} else if (graph == '3') {
console.log("graph-type3: "+graph)
document.getElementById("selection").style.display = 'none';
document.getElementById("selection_bar").style.display = '';
document.getElementById("selection_tree").style.display = 'none';
} else if (graph == '4') {
console.log("graph-type4: "+graph)
document.getElementById("selection").style.display = 'none';
document.getElementById("selection_bar").style.display = 'none';
document.getElementById("chart1").style.display='';
document.getElementById("chart2").style.display='none';
document.getElementById("selection_tree").style.display = 'none';
} else if (graph == '5') {
console.log("graph-type5: "+graph)
document.getElementById("selection").style.display = 'none';
document.getElementById("selection_bar").style.display = 'none';
document.getElementById("chart1").style.display='none';
document.getElementById("chart2").style.display='';
document.getElementById("selection_tree").style.display = 'none';
} else if (graph == '6') {
console.log("graph-type5: "+graph)
document.getElementById("selection").style.display = 'none';
document.getElementById("selection_bar").style.display = 'none';
document.getElementById("chart1").style.display='none';
document.getElementById("chart2").style.display='none';
document.getElementById("selection_tree").style.display = '';
}
});
$('#clickViewGraphs').click(function () {
document.getElementById("graph_img").style.display = 'none';
document.getElementById("chart1").style.display = 'none';
document.getElementById("chart2").style.display = 'none';
var graph = $('#graph-type').val();
if (graph == "1") {
var x = $('#x_label').val()
var y = $('#y_label').val()
//XY Plot
document.getElementById("donutchart").style.display = 'none';
document.getElementById("donutchart").style.width = "0px";
document.getElementById("donutchart").style.height = "0px";
document.getElementById("graph_img").style.display = '';
if (x == '1' && y == '1') {
$('#graph_img').attr('src','Figure/peakDemandSumVsGen.png');
} else if (x == '1' && y == '2') {
$('#graph_img').attr('src','Figure/peakDemandWinVsGen.png');
} else if (x == '1' && y == '3') {
$('#graph_img').attr('src','Figure/totGenByState.png');
} else if (x == '1' && y == '4') {
$('#graph_img').attr('src','Figure/totGenByUType.png');
} else if (x == '2' && y == '1') {
$('#graph_img').attr('src','Figure/noPlot.png');
} else if (x == '2' && y == '2') {
$('#graph_img').attr('src','Figure/noPlot.png');
} else if (x == '2' && y == '3') {
$('#graph_img').attr('src','Figure/powerLossAllKinds.png');
} else if (x == '2' && y == '4') {
$('#graph_img').attr('src','Figure/noPlot.png');
} else if (x == '3' && y == '1') {
$('#graph_img').attr('src','Figure/noPlot.png');
} else if (x == '3' && y == '2') {
$('#graph_img').attr('src','Figure/noPlot.png');
} else if (x == '3' && y == '3') {
$('#graph_img').attr('src','Figure/totRevenueByState.png');
} else if (x == '3' && y == '4') {
$('#graph_img').attr('src','Figure/noPlot.png');
} else if (x == '4' && y == '1') {
$('#graph_img').attr('src','Figure/noPlot.png');
} else if (x == '4' && y == '2') {
$('#graph_img').attr('src','Figure/summerWinterPeak.png');
} else if (x == '4' && y == '3') {
$('#graph_img').attr('src','Figure/noPlot.png');
} else if (x == '4' && y == '4') {
$('#graph_img').attr('src','Figure/noPlot.png');
}
} else if (graph == "2") {
// Show Pie Chart
document.getElementById("graph_img").style.display = 'none';
document.getElementById("donutchart").style.display = '';
document.getElementById("donutchart").style.width = "700px";
document.getElementById("donutchart").style.height = "400px";
// var div = document.createElement("div");
// div.setAttribute("id", "donutchart")
// div.style.width = "900px";
// div.style.height = "520px";
// document.getElementById("displayArea").appendChild(div);
} else if (graph == "3") {
var x = $('#x_label_bar').val()
var y = $('#y_label_bar').val()
// Show Bar Chart
//XY Plot
document.getElementById("donutchart").style.display = 'none';
document.getElementById("donutchart").style.width = "0px";
document.getElementById("donutchart").style.height = "0px";
document.getElementById("graph_img").style.display = '';
if (x == '1' && y == '1') {
$('#graph_img').attr('src','Figure/CustomerNumberRCIT.png');
} else if (x == '1' && y == '2') {
$('#graph_img').attr('src','Figure/RevenueRCIT.png');
} else if (x == '1' && y == '3') {
$('#graph_img').attr('src','Figure/PowerDeliveredRCIT.png');
}
} else if (graph == "4") {
document.getElementById("graph_img").style.display = 'none';
document.getElementById("donutchart").style.display = 'none';
document.getElementById("chart1").style.display='';
document.getElementById("chart2").style.display='none';
} else if (graph == "5") {
document.getElementById("graph_img").style.display = 'none';
document.getElementById("donutchart").style.display = 'none';
document.getElementById("chart1").style.display='none';
document.getElementById("chart2").style.display='';
} else if (graph == "6") {
document.getElementById("donutchart").style.display = 'none';
document.getElementById("donutchart").style.width = "0px";
document.getElementById("donutchart").style.height = "0px";
document.getElementById("graph_img").style.display = '';
var x = $('#selected_tree').val()
if (x == '1') {
$('#graph_img').attr('src','Figure/SourcesGenerationDecisionTree.png');
} else if (x == '2') {
$('#graph_img').attr('src','Figure/SourcesPurchasedDecisionTree.png');
} else if (x == '3') {
$('#graph_img').attr('src','Figure/SourcesTotalDecisionTree.png');
} else if (x == '4') {
$('#graph_img').attr('src','Figure/SummerPeakDemand.png');
} else if (x == '5') {
$('#graph_img').attr('src','Figure/WinterPeakDemand.png');
}
}
});
var chart1 = c3.generate({
bindto: "#chart1",
data: {
columns: [
["Total Generation of Power (MWh)", 6916431.0, 94490013.0, 55715570.0, 96248652.0, 324458359.0, 6402865.0, 101486615.0, 39227668.0, 10122968.0, 10079771.0, 299967369.0, 143429124.0, 9599248.0, 74809687.0, 21298495.0, 67260218.0, 123425199.0, 46930797.0, 67384202.0, 100330610.0, 43465938.0, 514494283.0, 8151082.0, 103735792.0, 127976481.0, 117494993.0, 52309087.0, 12720255.0, 197828433.0, 48086025.0, 56140826.0, 6082632.0, 34625121.0, 20818048.0, 40479149.0, 159749752.0, 186302938.0, 102203341.0, 219755024.0, 225408245.0, 5858602.0, 68691139.0, 14413753.0, 248821711.0, 773840664.0, 7257731.0, 116058018.0, 6143610.0, 130682456.0, 92475537.0, 54392.0, 7448970.0],
["Power losses of all kinds measured in megawatt hours", 357085.0, 4448349.0, 3068421.0, 4303615.0, 14768014.0, 0.0, 4151622.0, 1858385.0, 898247.0, 803143.0, 13593034.0, 6118751.0, 440866.0, 1736513.0, 1399418.0, 1869434.0, 5318550.0, 1796911.0, 2830552.0, 3763123.0, 1055204.0, 2224176.0, 218749.0, 4226527.0, 3546689.0, 3920962.0, 2536053.0, 866517.0, 8381897.0, 769574.0, 2114446.0, 371019.0, 1831202.0, 1142254.0, 1338628.0, 5485845.0, 7257792.0, 3471658.0, 5547029.0, 11693898.0, 330047.0, 2218050.0, 569944.0, 6171703.0, 14716925.0, 266012.0, 1927003.0, 284297.0, 4839739.0, 2266274.0, 4794.0, 359447.0]
],
types: {"Total Generation of Power (MWh)": "area-spline", "Power losses of all kinds measured in megawatt hours": "area-spline"},
groups: [["Total Generation of Power (MWh)", "Power losses of all kinds measured in megawatt hours"]]}
});
var chart2 = c3.generate({
bindto: "#chart2",
data: {
columns: [
["Investor Owned", 2348077855.0],
["Retail Power Marketer", 1543203536.0],
["Cooperative", 494085488.0],
["Municipal", 454847628.0],
["Federal", 288034058.0],
["Political Subdivision", 185429548.0],
["State", 91209595.0],
["Wholesale Power Marketer", 26292106.0],
["Community Choice Aggregator", 11826361.0],
["Behind the Meter", 6151714.0]],
"type": "bar"}
});
}
$(window).on('load', setup);
})();