Inconsistent column order

21 views
Skip to first unread message

Gregor Srdic

unread,
Mar 30, 2015, 10:30:24 AM3/30/15
to google-analyti...@googlegroups.com
Hello, 
I am trying to use super proxy with angular google charts https://github.com/bouil/angular-google-chart
In my query, I have a ga:date dimension and two numeric metrics and I would like to draw a line graph.


In JSON type response, columns are properly ordered so that date comes first, but if i use format=data-table, which returns data in format for chart, the column order is shuffled and date comes second!

format:json
{"kind": "analytics#gaData", "rows": [["20150324", "0", "0.0"], ["20150325", "0", "0.0"], ["20150326", "0", "0.0"], ["20150327", "35", "912.6"], ["20150328", "3", "954.6666666666666"], ["20150329", "2", "136.0"], ["20150330", "15", "1257.2"]], "containsSampledData": false, "itemsPerPage": 50, "totalResults": 7, "query": {"max-results": 50, "dimensions": "ga:date", "start-date": "2015-03-24", "start-index": 1, "end-date": "2015-03-30", "metrics": ["ga:totalEvents", "ga:avgEventValue"], "filters": "ga:eventCategory==general;ga:eventLabel==initialLoadDuration", "segment": "gaid::xzWV7gZuQE-XQInPRIKqkA"}, "totalsForAllResults": {"ga:totalEvents": "55", "ga:avgEventValue": "980.6363636363636"}, "columnHeaders": [{"dataType": "STRING", "columnType": "DIMENSION", "name": "ga:date"}, {"dataType": "INTEGER", "columnType": "METRIC", "name": "ga:totalEvents"}, {"dataType": "FLOAT", "columnType": "METRIC", "name": "ga:avgEventValue"}]}
 
format=data-table:
{"rows":[{"c":[{"v":0.0},{"v":"20150324"},{"v":0}]},{"c":[{"v":0.0},{"v":"20150325"},{"v":0}]},{"c":[{"v":0.0},{"v":"20150326"},{"v":0}]},{"c":[{"v":912.60000000000002},{"v":"20150327"},{"v":35}]},{"c":[{"v":954.66666666666663},{"v":"20150328"},{"v":3}]},{"c":[{"v":136.0},{"v":"20150329"},{"v":2}]},{"c":[{"v":1257.2},{"v":"20150330"},{"v":15}]}],"cols":[{"type":"number","id":"ga:avgEventValue","label":"ga:avgEventValue"},{"type":"string","id":"ga:date","label":"ga:date"},{"type":"number","id":"ga:totalEvents","label":"ga:totalEvents"}]}

This is really frustrating, any advice?
Thanks
Reply all
Reply to author
Forward
0 new messages