Changeset 2032
- Timestamp:
- Sep 26, 2011, 5:58:27 PM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/grails-app/controllers/dbnp/visualization/VisualizeController.groovy
r2031 r2032 146 146 // TODO: handle the case of multiple fields on an axis 147 147 // Determine data types 148 println "Determining rowType: "+inputData.rowIds[0] 148 149 def rowType = determineFieldType(inputData.studyIds[0], inputData.rowIds[0]) 150 println "Determining columnType: "+inputData.columnIds[0] 149 151 def columnType = determineFieldType(inputData.studyIds[0], inputData.columnIds[0]) 150 152 … … 533 535 */ 534 536 def formatData( type, groupedData, fields, groupAxis = "x", valueAxis = "y", errorName = "error" ) { 535 // TODO: Handle name and unit of fields correctly 536 def xAxis = groupedData[ groupAxis ].collect { it.toString() }; 537 def yName = parseFieldId( fields[ valueAxis ] ).name; 538 539 def return_data = [:] 540 return_data[ "type" ] = type 541 return_data.put("yaxis", ["title" : yName, "unit" : "" ]) 542 return_data.put("xaxis", ["title" : parseFieldId( fields[ groupAxis ] ).name, "unit": "" ]) 543 return_data.put("series", [[ 544 "name": yName, 545 "x": xAxis, 546 "y": groupedData[ valueAxis ], 547 "error": groupedData[ errorName ] 548 ]]) 549 550 return return_data; 537 // TODO: Handle name and unit of fields correctly 538 if(type=="table"){ 539 def xAxis = groupedData[ groupAxis ].collect { it.toString() }; 540 def yName = parseFieldId( fields[ valueAxis ] ).name; 541 542 def return_data = [:] 543 return_data[ "type" ] = type 544 return_data.put("yaxis", ["title" : yName, "unit" : "" ]) 545 return_data.put("xaxis", ["title" : parseFieldId( fields[ groupAxis ] ).name, "unit": "" ]) 546 return_data.put("x", []) 547 return_data.put("y", []) 548 return_data.put("data", []) 549 return_data.put("error", []) 550 551 return return_data; 552 } else { 553 def xAxis = groupedData[ groupAxis ].collect { it.toString() }; 554 def yName = parseFieldId( fields[ valueAxis ] ).name; 555 556 def return_data = [:] 557 return_data[ "type" ] = type 558 return_data.put("yaxis", ["title" : yName, "unit" : "" ]) 559 return_data.put("xaxis", ["title" : parseFieldId( fields[ groupAxis ] ).name, "unit": "" ]) 560 return_data.put("series", [[ 561 "name": yName, 562 "x": xAxis, 563 "y": groupedData[ valueAxis ], 564 "error": groupedData[ errorName ] 565 ]]) 566 567 return return_data; 568 } 551 569 } 552 570 … … 826 844 try{ 827 845 TemplateField tf = TemplateField.get(parsedField.id) 828 if(tf.type=="DOUBLE" || tf.type=="LONG" || tf.type=="DATE" || tf.type=="RELTIME"){ 846 if(tf.type==TemplateFieldType.DOUBLE || tf.type==TemplateFieldType.LONG || tf.type==TemplateFieldType.DATE || tf.type==TemplateFieldType.RELTIME){ 847 println "GSCF templatefield: NUMERICALDATA ("+NUMERICALDATA+") (based on "+tf.type+")" 829 848 return NUMERICALDATA 830 849 } else { 850 println "GSCF templatefield: CATEGORICALDATA ("+CATEGORICALDATA+") (based on "+tf.type+")" 831 851 return CATEGORICALDATA 832 852 }
Note: See TracChangeset
for help on using the changeset viewer.