Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
03/30/16 17:30:01 (8 years ago)
Author:
jlodewyc
Message:

#2582 Job Manager done. Start user management

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
     2var dataCollection = [];
     3//Possible task statusses
    24var taskStatus = {
    35    "Offline": "bar-off",
     
    1113}
    1214
     15
    1316function initSaveData(id, coll, name) {//initial data save
    1417    var temp = dataConversion(coll, name);
     
    1720    // console.log("#CREATION: " + id);
    1821}
     22//Saves updated info in dataCollection
    1923function saveData(id, coll, name) {
    2024    var temp = dataConversion(coll, name);
     
    2630        }
    2731    }
    28     //console.log("#SAVEDATA: " + id);
    2932    redrawGraph(id);
    3033}
     34//Returns data for line graph
     35//DISABLED FOR GANTT CHART
     36/*
    3137function getData(id) {
    3238    for (var i = 0; i < dataCollection.length; i++) {
     
    3541        }
    3642    }
    37 }
     43}*/
     44//Returns data needed for Pie chart
    3845function getDataPie(id) {
    3946    for (var i = 0; i < dataCollection.length; i++) {
     
    4350    }
    4451}
     52//Returns data needed for Gantt chart
    4553function getDataGantt(id) {
    4654    for (var i = 0; i < dataCollection.length; i++) {
     
    5058    }
    5159}
     60//Converts received data from server to data needed for the graphs
    5261function dataConversion(coll, name) {
    53     var line = null;//dataConversionLine(coll, name);
     62    //var line = dataConversionLine(coll, name);
    5463    var pie = dataConversionPie(coll);
    5564    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
    5868function dataConversionGantt(coll, nam) {
    5969    var tasks = [];
     
    93103    return [tasks, nam];
    94104}
    95 /*
     105/* DISABLED FOR GANTT CHART
    96106function dataConversionLine(coll, nam) {
    97107    var xarr = [];
     
    142152    return [data, layout];
    143153}*/
    144 
     154//Calculates data necessary for drawing  a pie chart for a single task.
    145155function dataConversionPie(coll) {
    146156    var waiting = 0;
     
    172182}
    173183
     184//Draws and redraws a graph from a single task
    174185function redrawGraph(val) {
    175186    document.getElementById("graph" + val).style.width = "100%";
     
    177188    document.getElementById("graph" + val).innerHTML = "";
    178189    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
    180192        setTimeout(function () {
    181193
     
    194206
    195207
    196         /* setTimeout(function () {
     208        /* DISABLED FOR GANTT CHART
     209        setTimeout(function () {
    197210            Plotly.newPlot('graph' + val, getData(val)[0], getData(val)[1]);
    198211        }, 100);*/
    199         // console.log("#REDRAWN LINE: " + val);
    200     } else {
     212    }
     213    else
     214    {//Redraws a pie chart
    201215        document.getElementById("legend" + val).style.display = "none";
    202216        setTimeout(function () {
    203217            Plotly.newPlot('graph' + val, getDataPie(val));
    204218        }, 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
    210225function redrawMain() {
    211226    document.getElementById("graphMain").innerHTML = "";
     
    215230    for (var i = 0; i < dataCollection.length; i++) {
    216231        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);
    218233
    219234        for (var v = 0; v < t.length; v++) {
Note: See TracChangeset for help on using the changeset viewer.