Changeset 2137


Ignore:
Timestamp:
Dec 22, 2011, 3:18:45 PM (11 years ago)
Author:
tjeerd@…
Message:

This commit makes time categorical

File:
1 edited

Legend:

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

    r2136 r2137  
    375375                }
    376376
     377        if( fieldInfo.x.fieldType == NUMERICALDATA && fieldInfo.y.fieldType == NUMERICALDATA) {
     378            if(inputData.visualizationType == "horizontal_barchart") {
     379                fieldInfo.y.fieldType = CATEGORICALDATA;
     380            } else if(inputData.visualizationType == "barchart") {
     381                fieldInfo.x.fieldType = CATEGORICALDATA;
     382            }
     383        }
     384
    377385                println "Fields: "
    378386                fieldInfo.each { println it }
     
    593601                        }
    594602                }
    595                
     603
    596604                // Compose a map with aggregated data
    597605                def aggregatedData = [:];
     
    14841492        def study = Study.get(studyId)
    14851493                def data = []
    1486                
    1487                 // If the fieldId is incorrect, or the field is not asked for, return 
     1494
     1495                // If the fieldId is incorrect, or the field is not asked for, return
    14881496                // CATEGORICALDATA
    1489                 if( !parsedField )
     1497                if( !parsedField ) {
    14901498                        return CATEGORICALDATA;
    1491 
     1499        }
    14921500        try{
    14931501            if( parsedField.source == "GSCF" ) {
    14941502                if(parsedField.id.isNumber()){
    1495                         return determineCategoryFromTemplateFieldId(parsedField.id)
     1503                    return determineCategoryFromTemplateFieldId(parsedField.id)
    14961504                } else { // Domainfield or memberclass
    14971505                    def callback = domainObjectCallback( parsedField.type )
    1498                                        
    14991506                    // Can the field be found in the domainFields as well? If so, treat it as a template field, so that dates and times can be properly rendered in a human-readable fashion
    1500                     if(callback.metaClass.methods.contains( "giveDomainFields" ) && callback?.giveDomainFields()?.name?.contains(parsedField.name.toString())){
     1507
     1508                    if(callback.metaClass.methods*.name.contains( "giveDomainFields" ) && callback?.giveDomainFields()?.name?.contains(parsedField.name.toString())){
    15011509                        // Use the associated templateField to determine the field type
    15021510                        return determineCategoryFromTemplateField(
     
    16061614     */
    16071615    protected int determineCategoryFromTemplateField(tf){
     1616
    16081617        if(tf.type==TemplateFieldType.DOUBLE || tf.type==TemplateFieldType.LONG){
    16091618            log.trace "GSCF templatefield: NUMERICALDATA ("+NUMERICALDATA+") (based on "+tf.type+")"
     
    17281737                types = [ [ "id": "barchart", "name": "Barchart"], [ "id": "linechart", "name": "Linechart"], [ "id": "boxplot", "name": "Boxplot"] ];
    17291738            } else {
    1730                 types = [ [ "id": "scatterplot", "name": "Scatterplot"], [ "id": "linechart", "name": "Linechart"] ];
     1739                types = [ [ "id": "scatterplot", "name": "Scatterplot"], [ "id": "linechart", "name": "Linechart"],  [ "id": "barchart", "name": "Barchart"], [ "id": "horizontal_barchart", "name": "Horizontal barchart"] ];
    17311740            }
    17321741        }
Note: See TracChangeset for help on using the changeset viewer.