Changeset 2061


Ignore:
Timestamp:
Oct 17, 2011, 12:10:04 PM (11 years ago)
Author:
tjeerd@…
Message:

VIS-39, added a message to inform users that in this prototype samples are required. Also some small code improvements are present in this changeset

Location:
trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/grails-app/controllers/dbnp/visualization/VisualizeController.groovy

    r2059 r2061  
    187187     *           - a key 'name' with a value equal to the name of the field in question, as determined by the source value
    188188     */
    189     def getFields(source, assay){
     189    def getFields(source, assay) {
    190190        def fields = []
    191191        def callUrl = ""
     
    419419                                        // Retrieve the value for the selected field for this sample
    420420                                        def value = closure( sample, parsedField.name );
    421                                        
    422                                         if( value != null ) {
    423                                                 data << value;
    424                                         } else {
    425                                                 // Return null if the value is not found
    426                                                 data << null
    427                                         }
     421
     422                    data << value;
    428423                                }
    429424                        } else {
  • trunk/grails-app/views/visualize/index.gsp

    r2057 r2061  
    8686                        <table>
    8787                            <tr>
    88                                 <td>Visualize the data as soon as enough parameters are known.</td>
     88                                <td><label for="autovis">Visualize the data as soon as enough parameters are known.</label></td>
    8989                                <td><input type="checkbox" name="autovis" id="autovis" CHECKED/></td>
    9090                            </tr>
    9191                            <tr>
    92                                 <td>Always show values in the graph.<br />(if this box is unchecked, value's are only shown when you hover over a datapoint)</td>
     92                                <td><label for="errorbars">Show errorbars in graph.<br />(only available with aggregation set to average)</label></td>
     93                                <td><input type="checkbox" name="errorbars" id="errorbars" CHECKED/></td>
     94                            </tr>
     95                            <tr>
     96                                <td><label for="showvalues">Always show values in the graph.<br />(if this box is unchecked, value's are only shown when you hover over a datapoint)</label></td>
    9397                                <td><input type="checkbox" name="showvalues" id="showvalues" onClick="changeVis();"/></td>
    9498                            </tr>
  • trunk/web-app/css/visualization.css

    r2057 r2061  
    7979    background: #87cefa;
    8080    cursor:pointer;
    81 }
    82 
    83 div#message_counter_container.message_warningnew {
    84     width: 50px;
    85     height: 50px;
    86     background-color: #eee;
    87 }
    88 
    89 div#message_counter_container.message_errornew {
    90     width: 150px;
    91     height: 150px;
    92     background-color: #ffe0e0;
    9381}
    9482
  • trunk/web-app/js/visualization.js

    r2055 r2061  
    5353        visualization.destroy();
    5454
    55     if($( '#study option:selected' ).length>0) {
     55    if($( '#study' ).find( 'option:selected' ).length>0) {
    5656        $( "#menu_row, #menu_column" ).find("img.spinner").show();
    57         $( "#menu_study" ).find("div.topmenu_item_info").html($( '#study option:selected' ).text());
     57        $( "#menu_study" ).find(".topmenu_item_info").html($( '#study').find( 'option:selected' ).text());
    5858
    5959        executeAjaxCall( "getFields", {
     
    8080                            strOptions += "<option value='"+field.id+"'>"+field.name+"</option>";
    8181                        });
    82                     strOptions += "</optgroup>";
    83                     $( "#rows, #columns" ).html(strOptions);
     82                    if(strOptions.length>0) {
     83                        strOptions += "</optgroup>";
     84                        $( "#rows, #columns" ).html(strOptions);
     85                    } else {
     86                        $("#visualization").html('<div style="padding: 30px">No fields could be found. This visualization prototype requires studies with samples.</div>');
     87                    }
    8488                       
    85                         $( "#menu_study" ).find("div.topmenu_item_info").html($( '#study option:selected' ).text());
    86                     $( "#menu_row, #menu_column" ).find("img.spinner").hide();
     89                        $( "#menu_study" ).find(".topmenu_item_info").html($( '#study').find( 'option:selected' ).text());
     90                    $( "#menu_row, #menu_column" ).find(".spinner").hide();
    8791                        $( "#menu_row, #menu_column" ).addClass("menu_item_fill");
    8892                }
     
    100104    $( "#"+divid ).addClass("menu_item_done");
    101105
    102     if($( '#rows option:selected' ).length>0 && $( '#columns option:selected' ).length>0) {
    103 
    104         $( "#menu_vis" ).find("img.spinner").show();
     106    if($( '#rows' ).find( 'option:selected' ).length>0 && $( '#columns' ).find( 'option:selected' ).length>0) {
     107
     108        $( "#menu_vis" ).find(".spinner").show();
    105109
    106110        executeAjaxCall( "getVisualizationTypes", {
     
    120124                    $.each( returnData, function( idx, field ) {
    121125                        $( '#types' ).append( $( "<option>" ).val( field.id ).text( field.name ) );
    122                         if( field.name==visType ) { $( '#types option:last' ).attr("selected","selected"); };
     126                        if( field.name==visType ) { $( '#types').find( 'option:last' ).attr("selected","selected"); };
    123127                    });
    124128                }
     
    130134                        visualization.destroy();
    131135                   
    132                     if($( '#types option' ).length==1) {
     136                    if($( '#types' ).find( 'option' ).length==1) {
    133137                        $( '#types :first-child' ).attr("selected","selected");
    134138                    }
    135                     if($( '#types option:selected' ).length>0) {
     139                    if($( '#types').find( 'option:selected' ).length>0) {
    136140                        changeVis();
    137141                    }
    138142                }
    139143
    140                 $( "#menu_vis" ).find("img.spinner").hide();
     144                $( "#menu_vis" ).find(".spinner").hide();
    141145
    142146            }
     
    150154function changeVis() {
    151155
    152     if($( '#types option:selected' ).length>0) {
     156    if($( '#types' ).find( 'option:selected' ).length>0) {
    153157        $( "#menu_vis" ).removeClass().addClass("menu_item menu_item_done");
    154158        visType = $( '#types option:selected' ).text();
     
    190194                if( !checkCorrectData( data.returnData ) ) {
    191195                    showError( ["Unfortunately the server returned data in a format that we did not expect."], "message_error" );
    192                     $( "#menu_go" ).find("img.spinner").hide();
     196                    $( "#menu_go" ).find(".spinner").hide();
    193197                    return;
    194198                }
     
    209213                if( dataPoints.length == 0 ) {
    210214                    showError( ["Unfortunately the server returned data without any measurements"], "message_error" );
    211                     $( "#menu_go" ).find("img.spinner").hide();
     215                    $( "#menu_go" ).find(".spinner").hide();
    212216                    return;
    213217                }
     
    412416                }
    413417
    414                 $( "#menu_go" ).find("img.spinner").hide();
     418                $( "#menu_go" ).find(".spinner").hide();
    415419            }
    416420        }, "menu_go");
     
    497501        // For simplicity, we send the whole form to the server. In the
    498502        // future this might be enhanced, based on the given type
    499         return $( 'form#visualizationForm' ).serialize();
     503        return $( '#visualizationForm' ).serialize();
    500504}
    501505
     
    525529                        // An error occurred while retrieving fields from the server
    526530                        showError( ["An error occurred while retrieving variables from the server. Please try again or contact a system administrator.<br />"+textStatus], "message_error" );
    527             $( "#"+divid ).removeClass().addClass('menu_item menu_item_error');
    528             $( "#"+divid ).find("img.spinner").hide();
     531            $( "#"+divid ).removeClass().addClass('menu_item_error');
     532            $( "#"+divid ).find(".spinner").hide();
    529533                }
    530534
Note: See TracChangeset for help on using the changeset viewer.