Changeset 2023


Ignore:
Timestamp:
Sep 19, 2011, 3:50:56 PM (5 years ago)
Author:
robert@…
Message:

Added x-values for all series in visualization controller

File:
1 edited

Legend:

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

    r2019 r2023  
    534534        def formatData( groupedData, fields, groupAxis = "x", valueAxis = "y", errorName = "error" ) {
    535535                // TODO: Handle name and unit of fields correctly
     536                def xAxis = groupedData[ groupAxis ].collect { it.toString() };
     537                def yName = parseFieldId( fields[ valueAxis ] ).name;
    536538               
    537539                def return_data = [:]
    538540                return_data[ "type" ] = "barchart"
    539                 return_data[ "x" ] = groupedData[ groupAxis ].collect { it.toString() }
    540                 return_data.put("yaxis", ["title" : parseFieldId( fields[ valueAxis ] ).name, "unit" : "" ])
     541                return_data[ "x" ] = xAxis
     542                return_data.put("yaxis", ["title" : yName, "unit" : "" ])
    541543                return_data.put("xaxis", ["title" : parseFieldId( fields[ groupAxis ] ).name, "unit": "" ])
    542544                return_data.put("series", [[
    543                         "name": "Y",
     545                        "name": yName,
     546                        "x": xAxis,
    544547                        "y": groupedData[ valueAxis ],
    545548                        "error": groupedData[ errorName ]
Note: See TracChangeset for help on using the changeset viewer.