Hi Melanie, would this work for you? (live example:
http://jsfiddle.net/JU2zN/ )
function drawRegionsMap() {
var data = new google.visualization.DataTable();
data.addRows(7);
data.addColumn('string', 'State');
data.addColumn('number', 'Legislation');
data.setValue(0, 0, 'Virginia');
data.setValue(0, 1, 2);
data.setFormattedValue(0, 1, 'Yes');
data.setValue(1, 0, 'Maryland');
data.setValue(1, 1, 2);
data.setFormattedValue(1, 1, 'Yes');
data.setValue(2, 0, 'Vermont');
data.setValue(2, 1, 2);
data.setFormattedValue(2, 1, 'Yes');
data.setValue(3, 0, 'Hawaii');
data.setValue(3, 1, 1);
data.setFormattedValue(3, 1, 'Pending');
data.setValue(4, 0, 'Colorado');
data.setValue(4, 1, 1);
data.setFormattedValue(4, 1, 'Pending');
data.setValue(5, 0, 'California');
data.setValue(5, 1, 1);
data.setFormattedValue(5, 1, 'Pending');
data.setValue(6, 0, 'Washington');
data.setValue(6, 1, 0);
data.setFormattedValue(6, 1, 'No');
var options = {};
options['region'] = 'US';
options['resolution'] = 'provinces';
options['width'] = 475;
options['height'] = 315;
options['colors'] = ['ffffff','blue'];
options['legend'] = 'none';
var container = document.getElementById('chart');
var geochart = new google.visualization.GeoChart(container);
geochart.draw(data, options);
}
What I changed is the following:
- I use only 2 columns : State and Legislation.
- Legislation is of numeric type with the meaning (0 = No, 1 = Pending, 2 =
Yes)
- to force the geo chart to show the labels (No, Pending, Yes) instead of
the numbers (0, 1, 2) I use setFormattedValue() on the same cell. For
example:
data.setValue(0, 0, 'Virginia');
data.setValue(0, 1, 2);
data.setFormattedValue(0, 1, 'Yes');
Here I set the 'formatted value' for cell (0,1) to be 'Yes', instead of the
default value of '2' (in your example you were setting the formatted value
of a separate, third column.
/R.
--
You received this message because you are subscribed to the Google Groups
"Google Visualization API" group.
To view this discussion on the web visit
https://groups.google.com/d/msg/google-visualization-api/-/h-r8wfMK_bcJ.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/google-visualization-api?hl=en.