googleanalytics / google-analytics-super-proxy

Publicly share your Google Analytics reporting data.
Other
224 stars 99 forks source link

Problem with query. Dates are returned as strings. #41

Open rjborter opened 9 years ago

rjborter commented 9 years ago

I built a simple query using the Explorer to bring back the number of visits for each day during a 60 day period which is working and have the URL copied to the superProxy in the apps engine. When I create a web page using the URL and display the results using Google Charts the labels along the x-axis are in the yyyymmdd string format. When I examine the data returned using the Manage Query page the data is listed as STRING no matter what format I click on (DataTable JSON Response, JSON String or just JSON) I have tried placing option=dataTable in the query string but that just seems to break the query. Is there some setting I am missing or is this a bug?

pfrisella commented 9 years ago

So everything is working, you just don't like the format of the date when using Google Charts? Have you looked at trying to change the format as described in Formatting Axis, Gridline, and Tick Labels?

rjborter commented 9 years ago

This is what I am using

var browserWrapper = new google.visualization.ChartWrapper({ "containerId": "browser", "dataSourceUrl": "https:// (mysite)/query?id=ag1zfnZkb3QtY3NjLTIwchULEghBcGlRdWVyeRiAgICAgICACgw&format=data-table-response", "refreshInterval": 43000, "chartType": "LineChart", "options": { "showRowNumber" : true, "width": 630, "height": 440, "is3D": true, "hAxis":{format:'MMM d, y'}, "vAxis": {"title": "Volume"}, "title": "CSC Test Script" } });

But I think the problem is how the data in the query is returned. No matter what format is chosen on the "Manage" page (DataTable (JSON Response) DataTable (JSON String) JSON ) the data coming back lists the ga:date field as a string and I would think this should come back as a date.

From the "Response Info" page the heading info states--

u'columnHeaders': [{u'dataType': u'STRING', u'columnType': u'DIMENSION', u'name': u'ga:date'},

Maybe I am setting something up wrong in the query or I am using hAxis incorrectly?

Any suggestion is appreciated.

--Robert

On Thu, Apr 9, 2015 at 4:30 PM, Pete Frisella notifications@github.com wrote:

So everything is working, you just don't like the format of the date when using Google Charts? Have you looked at trying to change the format as described in Formatting Axis, Gridline, and Tick Labels https://developers.google.com/chart/interactive/docs/datesandtimes#axesgridlinesticks ?

— Reply to this email directly or view it on GitHub https://github.com/googleanalytics/google-analytics-super-proxy/issues/41#issuecomment-91348074 .