Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No way of specifying mapsApiKey for using geoChart #197

Closed
malthusyau opened this issue Jul 31, 2017 · 6 comments
Closed

No way of specifying mapsApiKey for using geoChart #197

malthusyau opened this issue Jul 31, 2017 · 6 comments

Comments

@malthusyau
Copy link

For the geoChart, there is no way to include the mapsApiKey on google.charts.load. Like the example here: https://developers.google.com/chart/interactive/docs/basic_load_libs#load-settings

@wesalvaro
Copy link
Member

wesalvaro commented Aug 1, 2017

I believe this bug may have the solution for you:
google/google-visualization-issues#2292

Specifically, it seems you should just be able to set: google.visualization.mapsApiKey = YOUR_MAPS_KEY; before drawing your chart.

@djbecky
Copy link

djbecky commented Aug 1, 2017

I see there is a attribute named api-key in google-map, user could pass Google Maps Key to it.
Is it valuable to add this feature into google-chart?

@wesalvaro
Copy link
Member

wesalvaro commented Aug 1, 2017

@djbecky Yes, it probably is. I think we would just want to add an "options" type attribute to the loader element to allow users to specify their own options in a straight-forward Object fashion.
Since there is a work-around, I'd rather keep it the way it is at-the-moment and think about it a little more, adding it to the v2 update.

@djbecky
Copy link

djbecky commented Aug 1, 2017

@wesalvaro For now, I see google-chart only support three events (google-chart-select, google-chart-ready and selection-changed), I could not find the good time to set my API key before drawing.

@wesalvaro
Copy link
Member

wesalvaro commented Aug 2, 2017

Correct, you don't want to listen to the chart, but to the loader.

The loader will fire a loaded event (which should really be google-charts-loaded but alas...) which you can observe and then update your mapsApiKey as in this fiddle I created.

You can comment out the API key assignment line and see an error appear in the console about the lack of an API key. I'm not super familiar with the geochart, but it seems using the top level google-chart-loader element should solve the problem.

@wesalvaro wesalvaro added this to the Comprehensive API milestone Jan 12, 2018
@rslawik
Copy link
Contributor

rslawik commented Sep 20, 2019

mapsApiKey can be passed to the load function introduced in #245 together with other settings. custom-load-test has an example.
load still needs to be called before any chart is rendered.

@rslawik rslawik closed this as completed Sep 20, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants