Sorry, the GeoCharts do not recognize the sub-continent names, only the 
3-digit codes.  Here's a bit of code that will take the subcontinent names 
and give the 3-digit code:

function getSubcontinentCode(name) {
    var subcontinents = {
        'Northern Africa': '015',
        'Western Africa': '011',
        'Middle Africa': '017',
        'Eastern Africa': '014',
        'Southern Africa': '018',
        'Northern Europe': '154',
        'Western Europe': '155',
        'Eastern Europe': '151',
        'Southern Europe': '039',
        'Northern America': '021',
        'Caribbean': '029',
        'Central America': '013',
        'South America': '005',
        'Central Asia': '143',
        'Eastern Asia': '030',
        'Southern Asia': '034',
        'South-Eastern Asia': '035',
        'Western Asia': '145',
        'Australia and New Zealand': '053',
        'Melanesia': '054',
        'Micronesia: '057',
        'Polynesia': '061'
    };
    return subcontinents[name];
}

You can use a DataView to combine that with the subcontinent names in your 
DataTable, and draw the chart with the view:

var view = new google.visualization.DataView(data);
view.setColumns([{
    type: 'number',
    label: data.getColumnLabel(0),
    calc: function (dt, row) {
        return {v: getSubcontinentCode(dt.getValue(row, 0)), f: dt.getValue(
row, 0)};
    }
}, 1]);

On Saturday, April 6, 2013 2:05:08 AM UTC-4, Chevy Sim wrote:
>
> Hi there,
>
> Was just wondering if it's possible to plot the geochart datatable 
> dynamically using the names of the sub-continents instead of the continent 
> code?
> I am pulling data from google analytics which provides me with the geo sub 
> continents names (not code) dynamically.
>
> for example something like
>
>      var data = google.visualization.arrayToDataTable([
>             ['Sub Continent', 'Popularity'],
>             ['Northern America',1000]                                     
>                      
>         ]);
>
> Thanks in advance!
>

-- 
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 post to this group, send email to [email protected].
Visit this group at 
http://groups.google.com/group/google-visualization-api?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to