Hi,

i use spring an have created the following service.


@Controller
> @RequestMapping("REST")
> public class LoadDataSource {
>
> @Autowired
> private HttpServletRequest request;
>
> @RequestMapping(value="/DataSource/{Id}",method=RequestMethod.GET, 
> produces=MediaType.APPLICATION_JSON_VALUE)
>     public @ResponseBody DataTable createDataSource( @PathVariable Integer 
> Id){
>
> DataTable data = generateMyDataTable2();
>     
>
>    return data;
>   
>        
>         }
> private DataTable generateMyDataTable2() {
>     // Create a data table,
>     DataTable data = new DataTable();
>     ArrayList<ColumnDescription> cd = new ArrayList<ColumnDescription>();
>     cd.add(new ColumnDescription("id1", ValueType.NUMBER, "Date"));
>     cd.add(new ColumnDescription("id2", ValueType.NUMBER, "Berlin"));
>     cd.add(new ColumnDescription("id3", ValueType.NUMBER, "Offenburg"));
>     cd.add(new ColumnDescription("id4", ValueType.NUMBER, "Zunsweier"));
>     
>     data.addColumns(cd);
>     // Fill the data table.
>     try {
>       data.addRowFromValues(2010, 10, 12, 22);
>       data.addRowFromValues(2011, 20, 34, 33);
>       data.addRowFromValues(2012, 30, 23, 45);
>       data.addRowFromValues(2013, 40, 25, 50);
>     } catch (TypeMismatchException e) {
>       System.out.println("Invalid type!");
>     }
>     return data;
>   }


if i call this it returns me the following:

{"rows":[{"cells":[{"value":{"value":2010.0,"type":"NUMBER","null":false,"objectToFormat":2010.0},"formattedValue":null,"customProperties":{},"type":"NUMBER","null":false},{"value":{"value":10.0,"type":"NUMBER","null":false,"objectToFormat":10.0},"formattedValue":null,"customProperties":{},"type":"NUMBER","null":false},{"value":{"value":12.0,"type":"NUMBER","null":false,"objectToFormat":12.0},"formattedValue":null,"customProperties":{},"type":"NUMBER","null":false},{"value":{"value":22.0,"type":"NUMBER","null":false,"objectToFormat":22.0},"formattedValue":null,"customProperties":{},"type":"NUMBER","null":false}],"customProperties":{}},{"cells":[{"value":{"value":2011.0,"type":"NUMBER","null":false,"objectToFormat":2011.0},"formattedValue":null,"customProperties":{},"type":"NUMBER","null":false},{"value":{"value":20.0,"type":"NUMBER","null":false,"objectToFormat":20.0},"formattedValue":null,"customProperties":{},"type":"NUMBER","null":false},{"value":{"value":34.0,"type":"NUMBER","null":false,"objectToFormat":34.0},"formattedValue":null,"customProperties":{},"type":"NUMBER","null":false},{"value":{"value":33.0,"type":"NUMBER","null":false,"objectToFormat":33.0},"formattedValue":null,"customProperties":{},"type":"NUMBER","null":false}],"customProperties":{}},{"cells":[{"value":{"value":2012.0,"type":"NUMBER","null":false,"objectToFormat":2012.0},"formattedValue":null,"customProperties":{},"type":"NUMBER","null":false},{"value":{"value":30.0,"type":"NUMBER","null":false,"objectToFormat":30.0},"formattedValue":null,"customProperties":{},"type":"NUMBER","null":false},{"value":{"value":23.0,"type":"NUMBER","null":false,"objectToFormat":23.0},"formattedValue":null,"customProperties":{},"type":"NUMBER","null":false},{"value":{"value":45.0,"type":"NUMBER","null":false,"objectToFormat":45.0},"formattedValue":null,"customProperties":{},"type":"NUMBER","null":false}],"customProperties":{}},{"cells":[{"value":{"value":2013.0,"type":"NUMBER","null":false,"objectToFormat":2013.0},"formattedValue":null,"customProperties":{},"type":"NUMBER","null":false},{"value":{"value":40.0,"type":"NUMBER","null":false,"objectToFormat":40.0},"formattedValue":null,"customProperties":{},"type":"NUMBER","null":false},{"value":{"value":25.0,"type":"NUMBER","null":false,"objectToFormat":25.0},"formattedValue":null,"customProperties":{},"type":"NUMBER","null":false},{"value":{"value":50.0,"type":"NUMBER","null":false,"objectToFormat":50.0},"formattedValue":null,"customProperties":{},"type":"NUMBER","null":false}],"customProperties":{}}],"customProperties":{},"warnings":[],"localeForUserMessages":null,"columnDescriptions":[{"id":"id1","type":"NUMBER","label":"Date","pattern":"","customProperties":{}},{"id":"id2","type":"NUMBER","label":"Berlin","pattern":"","customProperties":{}},{"id":"id3","type":"NUMBER","label":"Offenburg","pattern":"","customProperties":{}},{"id":"id4","type":"NUMBER","label":"Zunsweier","pattern":"","customProperties":{}}],"numberOfColumns":4,"numberOfRows":4}
>  



But if i add this Directly to "dataView = new 
google.visualization.DataView({"rows":[{"cells":[{"value":{"value":2010.0,....."
 
i get the following error "TypeError: Object #<Object> has no method 'I'" What 
is wrong with my code ? and can i load my service directly with the google 
api ? i want only the dataTable, that i can work with it.
 

-- 
You received this message because you are subscribed to the Google Groups 
"Google Visualization API" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/google-visualization-api.
For more options, visit https://groups.google.com/d/optout.

Reply via email to