$value){ $string .="$value|"; } $string = str_replace(' ', '', $string); $stringCountryCode = ''; foreach($countryCodeShort as $keyCode => $valueCountryCode){ $stringCountryCode .="$valueCountryCode"; } $stringCountryCode = str_replace(' ', '', $stringCountryCode); //echo "Country Code String --> $stringCountryCode"; ?> "; //dynamic graph witdh $graphWidth = ((50*$totalCountryNum)+100); // And here's the function function chart_data($values) { // Port of JavaScript from http://code.google.com/apis/chart/ // http://james.cridland.net/code // First, find the maximum value from the values given //$maxValue = max($values); $maxValue = 500; // A list of encoding characters to help later, as per Google's example $simpleEncoding = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789'; $chartData = "s:"; for ($i = 0; $i < count($values); $i++) { $currentValue = $values[$i]; if ($currentValue > -1) { $chartData.=substr($simpleEncoding,61*($currentValue/$maxValue),1); } else { $chartData.='_'; } } // Return the chart data - and let the Y axis to show the maximum value return $chartData; } //this displayes the map chart echo "

"; echo ""; ?>