Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $url = 'https://chart.googleapis.com/chart?cht=map:fixed=20,-160,55,-35&chs=600x400&';
- $chco = 'cccccc|'; // the colors
- $chld = ''; // the states
- foreach ($states as $state => $total) {
- $chld .= 'US-' . $state . '|'; // Add the state ID
- // The logic to color the states light, medium, or dark red:
- if($total < 2) {
- $chco .= 'ffcccc|';
- }
- else if ($total < 4) {
- $chco .= 'ff6666|';
- }
- else {
- $chco .= '990000|';
- }
- }
- $chco = rtrim($chco, '|'); // Removes the trailing bar
- $url = $url . 'chco=' . $chco . '&chld=' . $chld; // Build the URL
- echo '<img src="' . $url . '" />'; // Insert the image into the page
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement