Google Charts api: Map of the United States

Map of USA

A simple Google Charts api example of a color coded map. The color intensities are determined by the value in the data array associated with each state.

?php $chart = array(); $chart['#title'] = 'Map of USA'; $chart['#chart_id'] = 'test_chart'; $chart['#type'] = CHART_TYPE_MAP; //Map Type $chart['#countries'] = array('TX','MN','CA'); //Array of ISO country codes (2 letter codes) $chart['#georange'] = 'usa'; //Geographic Range of the Map - continent name or 'world' $chart['#data'] = array(100,50,10); //Value affects intensity of colours which will be in the range defined by #data_colours second and third elements $chart['#data_colors'] = array('94d693', 'ffc000', 'ff0000'); //3 values for the colour (all other countries, start colour and end colour) $chart['#size'] = chart_size(440,220); echo theme('chart', array('chart' => $chart));

Read More