I am using JQVMAP at here. When I have a country that has members I desire to change that country's color without mousing over it, as the map is displayed.
I am using the following sql to get the countries and the number of their members. My question is what do I do, once I have a country, to change that countries map color? All countries will have the same color.
$result=mysql_query("SELECT COUNT(profile3.organizations) total_org, LEFT(countryCODEconversions.Code, 2) FROM profile3, countryCODEconversions WHERE TRIM(MID(countryCODEconversions.Code, 4, 147)) = profile3.country GROUP by profile3.country");
//if(mysql_num_rows($result)>0){
$counter = "";
while ($line = mysql_fetch_array($result, MYSQL_ASSOC))
{
foreach ($line as $value) {
$counter += 1;
$value = stripslashes($value);
if ($counter == 1){$total = nl2br($value);}
if ($counter == 2){
$counter = 0;
$countryCode = strtolower($value);
?>
gdpOrgData['<?=$countryCode?>']=("<?=$total?>");
<?
Normaly, after loading the map you can set the color of countries that need a different color like this:
jQuery(document).ready(function() {
jQuery('#vmap').vectorMap('set', 'colors', {lt: '#8c9622',
sv: '#8c9622',
yr: '#8c9622'});
});
You could use PHP to generate the list in this script. Just make sure to load it after the map is loaded. I hope this points you in the correct direction.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With