Can you display multiple date ranges on the same chart?

113 views
Skip to first unread message

Kurt Peters

unread,
Jun 18, 2013, 8:07:29 PM6/18/13
to ga-easy-da...@googlegroups.com
Is it possible to display two data series on the same chart when using the Easy Dashboard library? Ideally what I'd like to be able to do is show two different date ranges on the same chart (basically what the "Compare to:" does within Google Analytics).

nick

unread,
Jun 19, 2013, 12:41:31 PM6/19/13
to ga-easy-da...@googlegroups.com
Hi,

Currently not using this ez-daah-library.

Today the API only allows you to query for a single date range, and each chart only displays a single query.

To solve this using this library would require you issue 2 queries, join them in a single data table, then visualize using multiple axis.

-Nick

Kurt Peters

unread,
Jun 19, 2013, 1:36:39 PM6/19/13
to ga-easy-da...@googlegroups.com
That's what I figured (although I was secretly hoping I was just missing something). Thanks for the response!

Kurt Peters

unread,
Jun 27, 2013, 4:38:01 PM6/27/13
to ga-easy-da...@googlegroups.com
I'm going to tag onto this because it's vaguely related:

I have a function defined (let's calling it "combineData") that will join the results from two different queries (and then display the resulting array on a chart). The issue that I'm running into now is that I can not for the life of me, get this "combineData" function to wait until the two query functions have returned results. I have tried a separate async library, I've tried jQuery's deferred "$.when.done()", but nothing works. I defined callback functions for the two GADash functions, and then even tried calling them [e.g. $.when(visitors1(callbackfunc), visitors2(callbackfunc)).then(combineData);].

With everything I've tried, it always executes the two GADash functions and then, without waiting for those two functions to actually return a result, the combineData() function. What am I missing?

nick

unread,
Jun 27, 2013, 5:42:45 PM6/27/13
to ga-easy-da...@googlegroups.com
You need to synchronize the two async requests.

Set up a counter for the number of requests.
Create a single callback that both async requests call.

In the call back, increment the counter. If the counter < number requests, save the data, if counter == number of requests, do something with all the data.

Of course there are a bunch of clever ways to make this generic.
-Nick

Kurt Peters

unread,
Jun 28, 2013, 5:02:06 PM6/28/13
to ga-easy-da...@googlegroups.com
Thank you! It finally works!
Reply all
Reply to author
Forward
0 new messages