use*_*437 2 jquery amcharts ammap
我创建了amMap来绘制区域,我想禁用工具提示并在特定状态下点击添加infowindow.我怎样才能做到这一点.
如果要禁用工具提示,请将其设置balloonText为空字符串areasSettings.
"areasSettings": {
"balloonText": ""
}
Run Code Online (Sandbox Code Playgroud)
要显示单击某个状态的描述,只需将"description"属性添加到该状态的区域定义:
"dataProvider": {
"map": "usaLow",
"getAreasFromMap": true,
"areas": [{
"id": "US-TX",
"description": "Texas is a large state in the southern U.S. with deserts, pine forests and the Rio Grande, a river that forms its border with Mexico. In its biggest city, Houston, the Museum of Fine Arts houses works by well-known Impressionist and Renaissance painters, while Space Center Houston offers interactive displays engineered by NASA. Austin, the capital, is known for its eclectic music scene."
}]
}
Run Code Online (Sandbox Code Playgroud)
请记住还要包含ammap.css,因为描述框是用CSS设置的.
这是一个有效的演示:
var map = AmCharts.makeChart( "chartdiv", {
"type": "map",
"theme": "light",
"dataProvider": {
"map": "usaLow",
"getAreasFromMap": true,
"areas": [{
"id": "US-TX",
"description": "Texas is a large state in the southern U.S. with deserts, pine forests and the Rio Grande, a river that forms its border with Mexico. In its biggest city, Houston, the Museum of Fine Arts houses works by well-known Impressionist and Renaissance painters, while Space Center Houston offers interactive displays engineered by NASA. Austin, the capital, is known for its eclectic music scene."
}]
},
"areasSettings": {
"autoZoom": true,
"balloonText": ""
}
} );Run Code Online (Sandbox Code Playgroud)
#chartdiv {
width: 100%;
height: 500px;
}Run Code Online (Sandbox Code Playgroud)
<link href="http://www.amcharts.com/lib/3/ammap.css" media="all" rel="stylesheet" type="text/css" />
<script src="http://www.amcharts.com/lib/3/ammap.js"></script>
<script src="http://www.amcharts.com/lib/3/maps/js/usaLow.js"></script>
<script src="http://www.amcharts.com/lib/3/themes/light.js"></script>
<div id="chartdiv"></div>Run Code Online (Sandbox Code Playgroud)