Ignore:
Timestamp:
02/21/12 13:56:17 (13 years ago)
Author:
tjcschipper
Message:

Laatste versie van de 'oude' dashboard interface.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • Dev/branches/Cartis/js/dashboardScripts.js

    r242 r276  
    2222var mockupData = {
    2323    muData1: [1,2,3,4,5,6], //pie charts
    24     muData2: [[1,2,3],[4,5,6]], //bar charts
    25     muData3: [[1,2],[3,4],[5,6]]    //radar charts
     24    muData2: [[1,7],[4,2],[9,6]], //bar charts
     25    muData3: [6,8,7,5,9,7,6,4],    //radar charts
     26    muData4 : [8,34,6,56,3,23] // rose charts
    2627}
    2728
     
    4041    var uid = values[values.length-1];
    4142    var type;
     43   
    4244    switch (selectBox.id) {
    4345        case "dbSessionInstancesList":
     
    5052            break;
    5153        default:
    52             alert("No valid type passed!");
     54            var value = values[0];
     55            var opt;
     56            for (var n = 0; n < selectBox.options.length; n++) {
     57                if (selectBox.options[n].value == value) {
     58                    opt = selectBox.options[n];
     59                    type = opt.attributes[1].value;
     60                }
     61            }
     62            if (type == null || type == undefined) //error?!?!?!
    5363            break;
    5464    }
     
    208218    form.appendChild(input);
    209219    form.submit();
    210     //alert("Graph type is now: "+graphSelection);
     220//alert("Graph type is now: "+graphSelection);
    211221   
    212222}
     
    225235            graphSelection.graphType = "Pie";
    226236            break;
     237        case "rose":
     238            graphSelection.graphType = "Rose";
     239            break;
    227240        default:
    228241            break;
     
    233246    drawGraph('chart1', 450, 200, graphSelection.graphType, data);
    234247   
    235    // alert("Graph type is now: "+graphSelection.graphType);
     248// alert("Graph type is now: "+graphSelection.graphType);
    236249}
    237250
     
    247260     */
    248261    // temporary!!!;
    249     graphSelection.graphData = mockupData.muData1;
    250     return mockupData.muData1;
    251    
    252     //alert("Data is now being formatted");
     262   
     263    switch (graphSelection.graphType) {
     264        case "Bar":
     265            graphSelection.graphData = mockupData.muData2;
     266            break;
     267        case "Pie":
     268            graphSelection.graphData = mockupData.muData1;
     269            break;
     270        case "Radar":
     271            graphSelection.graphData = mockupData.muData3;
     272            break;
     273        case "Rose":
     274            graphSelection.graphData = mockupData.muData4;
     275            break;
     276    }
     277   
     278    return graphSelection.graphData;
     279   
     280//alert("Data is now being formatted");
    253281}
    254282
     
    271299        case "Bar":
    272300            chart1 = new RGraph.Bar(name, data);
     301            chart1.Set('chart.labels', ['1 fault', '2 faults', '3 faults', '4 faults', '5 faults', '6 faults']);
     302            chart1.Set('chart.colors', ['#77f', '#7f7', '#f77']);
    273303            break;
    274304        case "Pie":
    275305            chart1 = new RGraph.Pie(name, data);
     306            chart1.Set('chart.labels', ['1 fault', '2 faults', '3 faults', '4 faults', '5 faults', '6 faults']);
     307            chart1.Set('chart.colors', ['#77f', '#7f7', '#f77']);
    276308            break;
    277309        case "Radar":
    278310            chart1 = new RGraph.Radar(name, data);
    279             break;
    280         default:
    281             break;
    282     }
    283    
    284     //chart1.Set('chart.background.barcolor1', 'white');
    285     // chart1.Set('chart.background.barcolor2', 'white');
    286     chart1.Set('chart.labels', ['1st', '2nd', '3rd', '4th', '5th', '6th']);
    287     //chart1.Set('chart.key', ['Aapjes', 'Hertjes']);
    288     //chart1.Set('chart.key.position.y', 35);
    289     //chart1.Set('chart.key.position', 'gutter');
    290     //chart1.Set('chart.key.background', 'rgb(255,255,255)');
    291     chart1.Set('chart.colors', ['#77f', '#7f7']);
    292     chart1.Set('chart.shadow', true);
    293     chart1.Set('chart.shadow.blur', 15);
     311            chart1.Set('chart.colors.alpha', '50%');
     312            chart1.Set('chart.colors', ['rgba(112,112,240,0.5)', 'rgba(112,240,112,0.5)', 'rgba(240,112,112,0.5)']);
     313            break;
     314        case "Rose":
     315            chart1 = new RGraph.Rose(name, data);
     316            chart1.Set('chart.labels', ['1 fault', '2 faults', '3 faults', '4 faults', '5 faults', '6 faults']);
     317            chart1.Set('chart.colors', ['#77f', '#7f7', '#f77']);
     318            break;
     319        default:
     320            break;
     321    }
     322   
     323   
     324   
     325    chart1.Set('chart.shadow', false);
     326    chart1.Set('chart.shadow.blur', 0);
    294327    chart1.Set('chart.shadow.offsetx', 0);
    295328    chart1.Set('chart.shadow.offsety', 0);
     
    308341}
    309342
     343
     344
    310345function addToDashboard() {
     346    alert('You saved "'+graphSelection.graphType.toLowerCase()+' chart" to dashboard!');   
    311347    doorstuurData.graphs.push(["graph"+doorstuurData.count+1, 450, 200, graphSelection.graphType, graphSelection.graphData]);
    312348    doorstuurData.count++;
    313349}
     350//Helper
     351
     352function checkBack(url) {
     353    if (confirm("Are you sure you want to go back? You will lose your selected data.")) {
     354        window.location = url ;
     355    }
     356}
     357
Note: See TracChangeset for help on using the changeset viewer.