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

GoogleCharts.Map Not Displaying #134

Open
gordonklarson opened this issue Feb 23, 2020 · 2 comments
Open

GoogleCharts.Map Not Displaying #134

gordonklarson opened this issue Feb 23, 2020 · 2 comments

Comments

@gordonklarson
Copy link

When running the sample code for GoogleCharts.Map from https://fslab.org/XPlot/chart/google-map-chart.html I get a message saying "No data points to show on map"
image

@zyzhu
Copy link
Contributor

zyzhu commented Feb 24, 2020

By reading the error message in console. It seems related to the change of Google Map's API policy
https://cloud.google.com/maps-platform/user-guide/account-changes/#no-plan

You must have a valid API key and a billing account to access our APIs. When you enable billing, you will get $200 free usage every month for Maps, Routes, or Places. Based on the millions of users using our APIs today, most of them can continue to use Google Maps Platform for free with this credit. Having a billing account helps us understand our developers’ needs better and allows you to scale seamlessly.

To avoid a service interruption to your projects, please visit our Get Started page to create a project, generate an API key, and enable a billing account. Once you generate and obtain an API key, make sure to update your application with the new API key.

@zyzhu
Copy link
Contributor

zyzhu commented Feb 25, 2020

I gave it a shot today by creating a dummy project on Google. It requires billing information but first $200 every month is still free.

After you sign up, Google provides an API key. Pipe your map to |> Chart.WithApiKey "key" and it works fine afterwards.

let data =
    [
        "China", "China: 1,363,800,000"
        "India", "India: 1,242,620,000"
        "US", "US: 317,842,000"
        "Indonesia", "Indonesia: 247,424,598"
        "Brazil", "Brazil: 201,032,714"
        "Pakistan", "Pakistan: 186,134,000"
        "Nigeria", "Nigeria: 173,615,000"
        "Bangladesh", "Bangladesh: 152,518,015"
        "Russia", "Russia: 146,019,512"
        "Japan", "Japan: 127,120,000"
    ]

let options = Options(showTip = true)

data
|> Chart.Map
|> Chart.WithOptions options
|> Chart.WithHeight 420
|> Chart.WithApiKey "key"
|> Chart.Show

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants