It's a bit complex, unfortunately. You could move your document ready handler inside your drawChart, but further, you have to wait for the getJSON handler. So it might be simpler to move your google.charts.load and setOnLoadCallback into your getJSON handler.
There ought to be a simpler way to wait for both, perhaps involving Promises. The google.charts.loader does return a Promise now, but I don't know about your getJSON call. On Thu, Apr 16, 2020 at 11:36 AM Shivan Singh <[email protected]> wrote: > How to Combine into one so that data2 is defined before it is used? > > -- > 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 view this discussion on the web visit > https://groups.google.com/d/msgid/google-visualization-api/be43a4f1-757c-4d86-bd2b-7fe2c5409c2a%40googlegroups.com > <https://groups.google.com/d/msgid/google-visualization-api/be43a4f1-757c-4d86-bd2b-7fe2c5409c2a%40googlegroups.com?utm_medium=email&utm_source=footer> > . > -- Daniel LaLiberte <https://plus.google.com/100631381223468223275?prsrc=2> [email protected] <[email protected]> Cambridge MA -- 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 view this discussion on the web visit https://groups.google.com/d/msgid/google-visualization-api/CAOtcSJP7nDgBQVj_tAUMDs9bTtE-iwx9OtzsTEe7a0Ke9snhgA%40mail.gmail.com.
