Changeset 2058
- Timestamp:
- Oct 13, 2011, 2:46:21 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/grails-app/controllers/dbnp/visualization/VisualizeController.groovy
r2056 r2058 343 343 returnData = formatData( inputData.visualizationType, groupedData, fields, groupAxisType, valueAxisType ); // Don't indicate axis ordering, standard <"x", "y"> will be used 344 344 } 345 println "returnData: "+returnData346 345 return sendResults(returnData) 347 346 } … … 672 671 */ 673 672 def formatData( type, groupedData, fields, groupAxisType, valueAxisType, groupAxis = "x", valueAxis = "y", errorName = "error" ) { 674 // We want to sort the data based on the group-axis, but keep the values on the value-axis in sync. 673 // We want to sort the data based on the group-axis, but keep the values on the value-axis in sync. 675 674 // The only way seems to be to combine data from both axes. 676 675 def combined = [] … … 679 678 combined << [ "group": group, "data": groupedData[ 'data' ][ i ] ] 680 679 } 681 combined.sort { it.group }680 combined.sort { it.group.toString() } 682 681 groupedData[groupAxis] = renderTimesAndDatesHumanReadable(combined*.group, groupAxisType) 683 682 groupedData[valueAxis] = renderTimesAndDatesHumanReadable(groupedData[valueAxis], valueAxisType) … … 687 686 combined << [ "group": group, "value": groupedData[ valueAxis ][ i ] ] 688 687 } 689 combined.sort { it.group }688 combined.sort { it.group.toString() } 690 689 groupedData[groupAxis] = renderTimesAndDatesHumanReadable(combined*.group, groupAxisType) 691 690 groupedData[valueAxis] = renderTimesAndDatesHumanReadable(combined*.value, valueAxisType) 692 691 } 693 694 692 // TODO: Handle name and unit of fields correctly 695 693 def valueAxisTypeString = (valueAxisType==CATEGORICALDATA || valueAxisType==DATE || valueAxisType==RELTIME ? "categorical" : "numerical") … … 735 733 def renderTimesAndDatesHumanReadable(data, axisType){ 736 734 if(axisType==RELTIME){ 737 println "RELTIME"738 735 data = renderTimesHumanReadable(data) 739 736 } 740 737 if(axisType==DATE){ 741 println "DATE"742 738 data = renderDatesHumanReadable(data) 743 739 } 744 println "NO JOY"745 740 return data 746 741 } … … 754 749 def tmpTimeContainer = [] 755 750 data. each { 756 println "\t"+it757 751 if(it instanceof Number) { 758 752 try{ … … 776 770 def tmpDateContainer = [] 777 771 data. each { 778 println "\t"+it779 772 if(it instanceof Number) { 780 773 try{
Note: See TracChangeset
for help on using the changeset viewer.