【问题标题】:JQVMAP Country ColoringJQVMAP乡村着色
【发布时间】:2015-03-21 10:01:43
【问题描述】:

我在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?>"); <?

【问题讨论】:

  • 您想在加载地图时为这些国家/地区着色,还是要实时进行?
  • 加载地图时。

标签: colors country jqvmap


【解决方案1】:

通常,加载地图后,您可以像这样设置需要不同颜色的国家/地区的颜色:

jQuery(document).ready(function() {
       jQuery('#vmap').vectorMap('set', 'colors', {lt: '#8c9622', 
                                                    sv: '#8c9622', 
                                                    yr: '#8c9622'});
});

您可以使用 PHP 在此脚本中生成列表。只需确保在加载地图后加载它。 我希望这能为您指明正确的方向。

【讨论】:

  • 那太好了,谢谢你...我想奖励你10,000分!
猜你喜欢
  • 2015-10-27
  • 1970-01-01
  • 2023-03-10
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多