Jam*_*ull 5 country colors jqvmap
我在这里使用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?>");
<?
通常,加载地图后,您可以设置需要不同颜色的国家/地区的颜色,如下所示:
jQuery(document).ready(function() {
jQuery('#vmap').vectorMap('set', 'colors', {lt: '#8c9622',
sv: '#8c9622',
yr: '#8c9622'});
});
Run Code Online (Sandbox Code Playgroud)
您可以使用 PHP 在此脚本中生成列表。只需确保在加载地图后加载它即可。我希望这能为您指明正确的方向。