Regions are not displayed in map chart with provinces

88 views
Skip to first unread message

joel_s

unread,
Oct 21, 2019, 6:45:27 AM10/21/19
to Google Visualization API
Hi!

I use Google Analytics Embed API to show chart with analytics data.
I can get the chart to show countries in a filled color.
But my aim is to show data for a specific country (Sweden) and display the regions where people have been visiting the site.
But if I set it to a region (Sweden) and set it to "resolution: 'provinces' ", no region is filled with a color.

Here is the way I specify the data and the chart:

var location = new gapi.analytics.googleCharts.DataChart({

    query: {

        'ids': viewId,

        'start-date': '90daysAgo',

       'end-date': 'today',

       'metrics': 'ga:users',

       'sort': '-ga:users',

       'dimensions': 'ga:region',

       'max-results': 10

    },

   chart: {

      'container': 'location',

      'type': 'GEO',

      'options': {

      region: 'SE',

      resolution: 'provinces'

   }

}

});


Since I specify "ga:region" in the query, I get regional data back correctly in this form:


"dataTable": {
        "cols": [
            {
                "id": "ga:region",
                "label": "ga:region",
                "type": "string"
            },
            {
                "id": "ga:users",
                "label": "ga:users",
                "type": "number"
            }
        ],
        "rows": [
            {
                "c": [
                    {
                        "v": "Stockholm County"
                    },
                    {
                        "v": "15"
                    }
                ]
            },
            {
                "c": [
                    {
                        "v": "Vastra Gotaland County"
                    },
                    {
                        "v": "6"
                    }
                ]
            },


Is this data sufficient and correct to be able to show regional data for a certain country?






Skärmklipp.JPG
Reply all
Reply to author
Forward
0 new messages