Changeset 13740 for branches/WebJobManager/HeuristicLab.Clients.Hive.WebJobManager/wwwroot/js/Scripts/Graphs/GraphDataCollector.js
- Timestamp:
- 03/30/16 17:30:01 (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/WebJobManager/HeuristicLab.Clients.Hive.WebJobManager/wwwroot/js/Scripts/Graphs/GraphDataCollector.js
r13735 r13740 1 var dataCollection = []; 1 //Keeps all the data for the job. Used to communicate through SignalR 2 var dataCollection = []; 3 //Possible task statusses 2 4 var taskStatus = { 3 5 "Offline": "bar-off", … … 11 13 } 12 14 15 13 16 function initSaveData(id, coll, name) {//initial data save 14 17 var temp = dataConversion(coll, name); … … 17 20 // console.log("#CREATION: " + id); 18 21 } 22 //Saves updated info in dataCollection 19 23 function saveData(id, coll, name) { 20 24 var temp = dataConversion(coll, name); … … 26 30 } 27 31 } 28 //console.log("#SAVEDATA: " + id);29 32 redrawGraph(id); 30 33 } 34 //Returns data for line graph 35 //DISABLED FOR GANTT CHART 36 /* 31 37 function getData(id) { 32 38 for (var i = 0; i < dataCollection.length; i++) { … … 35 41 } 36 42 } 37 } 43 }*/ 44 //Returns data needed for Pie chart 38 45 function getDataPie(id) { 39 46 for (var i = 0; i < dataCollection.length; i++) { … … 43 50 } 44 51 } 52 //Returns data needed for Gantt chart 45 53 function getDataGantt(id) { 46 54 for (var i = 0; i < dataCollection.length; i++) { … … 50 58 } 51 59 } 60 //Converts received data from server to data needed for the graphs 52 61 function dataConversion(coll, name) { 53 var line = null;//dataConversionLine(coll, name);62 //var line = dataConversionLine(coll, name); 54 63 var pie = dataConversionPie(coll); 55 64 var gantt = dataConversionGantt(coll, name); 56 return [line, pie, gantt]; 57 } 65 return [null, pie, gantt]; 66 } 67 //Creates all data needed for drawing a single Gantt chart for one task 58 68 function dataConversionGantt(coll, nam) { 59 69 var tasks = []; … … 93 103 return [tasks, nam]; 94 104 } 95 /* 105 /* DISABLED FOR GANTT CHART 96 106 function dataConversionLine(coll, nam) { 97 107 var xarr = []; … … 142 152 return [data, layout]; 143 153 }*/ 144 154 //Calculates data necessary for drawing a pie chart for a single task. 145 155 function dataConversionPie(coll) { 146 156 var waiting = 0; … … 172 182 } 173 183 184 //Draws and redraws a graph from a single task 174 185 function redrawGraph(val) { 175 186 document.getElementById("graph" + val).style.width = "100%"; … … 177 188 document.getElementById("graph" + val).innerHTML = ""; 178 189 document.getElementById("graph" + val).style.marginLeft = "0px"; 179 if (document.getElementById("graphtoggle" + val).checked) { 190 if (document.getElementById("graphtoggle" + val).checked) 191 {//Redraws a Gantt chart 180 192 setTimeout(function () { 181 193 … … 194 206 195 207 196 /* setTimeout(function () { 208 /* DISABLED FOR GANTT CHART 209 setTimeout(function () { 197 210 Plotly.newPlot('graph' + val, getData(val)[0], getData(val)[1]); 198 211 }, 100);*/ 199 // console.log("#REDRAWN LINE: " + val); 200 } else { 212 } 213 else 214 {//Redraws a pie chart 201 215 document.getElementById("legend" + val).style.display = "none"; 202 216 setTimeout(function () { 203 217 Plotly.newPlot('graph' + val, getDataPie(val)); 204 218 }, 100); 205 //console.log("#REDRAWN PIE: " + val); 206 } 207 208 209 } 219 } 220 221 222 } 223 //Draws and redraws the main Gantt chart. Taking info from the single task charts 224 //And combining these into one big chart 210 225 function redrawMain() { 211 226 document.getElementById("graphMain").innerHTML = ""; … … 215 230 for (var i = 0; i < dataCollection.length; i++) { 216 231 var t = dataCollection[i][3][0].slice(); 217 var name = t[0].taskName.substring(0, 5) + " | " + i + ":";232 var name = t[0].taskName.substring(0, 5) + " | " + (i+1); 218 233 219 234 for (var v = 0; v < t.length; v++) {
Note: See TracChangeset
for help on using the changeset viewer.