我在here上使用JQVMAP。当我有一个有成员的国家时,我希望在地图显示时更改该国家的颜色,而不是将鼠标移到它上面。
我使用以下sql来获取国家/地区及其成员数量。我的问题是,一旦我有了一个国家,我该怎么做才能改变国家地图的颜色?所有国家都会有相同的颜色。
$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?>"); <?
发布于 2015-01-26 05:03:21
正常情况下,在加载地图后,您可以设置需要不同颜色的国家的颜色,如下所示:
jQuery(document).ready(function() {
jQuery('#vmap').vectorMap('set', 'colors', {lt: '#8c9622',
sv: '#8c9622',
yr: '#8c9622'});
});您可以使用PHP在此脚本中生成列表。只需确保在地图加载后加载它。我希望这为您指明了正确的方向。
https://stackoverflow.com/questions/28091705
复制相似问题