Advertisement
Guest User

Gavin

a guest
Jan 5th, 2011
281
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.62 KB | None | 0 0
  1. $url = 'https://chart.googleapis.com/chart?cht=map:fixed=20,-160,55,-35&chs=600x400&';
  2. $chco = 'cccccc|'; // the colors
  3. $chld = ''; // the states
  4. foreach ($states as $state => $total) {
  5.     $chld .= 'US-' . $state . '|'; // Add the state ID
  6.    
  7.     // The logic to color the states light, medium, or dark red:
  8.     if($total < 2) {
  9.         $chco .= 'ffcccc|';
  10.     }
  11.     else if ($total < 4) {
  12.         $chco .= 'ff6666|';
  13.     }
  14.     else {
  15.         $chco .= '990000|';
  16.     }
  17. }
  18. $chco = rtrim($chco, '|'); // Removes the trailing bar
  19. $url = $url . 'chco=' . $chco . '&chld=' . $chld; // Build the URL
  20. echo '<img src="' . $url . '" />'; // Insert the image into the page
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement