示例描述

该示例展示等级符号地图模板,使用Dituhui.MapType.BUBBLE接口设置。

效果演示

示例代码

<html>
 <head>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  <script src='http://dev.dituhui.com/sdk/1.0.0/js/dituhui-flash.js'></script>
  <script src='http://dev.dituhui.com/sdk/1.0.0/js/sample-data.js'></script>
  <script type="text/javascript">
   var map = null;
   /*初始化地图,设置地图模板为等级符号:
   Dituhui.MapType.BUBBLE*/
   function init(){
    map = new Dituhui.Map("myMap", "http://dev.dituhui.com/sdk/1.0.0/swfs/", "100000", Dituhui.MapType.BUBBLE, "setData", "onError");
   }
   function setData(){
    //markerSymbol:circle,square,star,triangle
    var mapStyles = [
     {min:0,max:4, markerSize:20,markerSymbol:'circle'},
     {min:4,max:8, markerSize:20,markerSymbol:'square'},
     {min:8,max:12, markerSize:20,markerSymbol:'star'},
     {min:12,max:16, markerSize:20,markerSymbol:'triangle'}];
    var option = 
    {
     data: data, 
     styles:mapStyles, 
     valueField:'gdprate',
     fillColorType:'red',
     mapFillColor:'#FADB61',
     backgroundColor:"#F5F5F5",
     legendTitle:"GDP增速%"
    };
    map.setMapOptions(option);
   }
   function onError(errorcode)
   {
    /*errorcode:错误编码,有关错误编码的详细描述可参考:
    "开发指南"-->"API参考"-->"错误编码"*/
    alert(errorcode);          
   }
   window.onload = init;
  </script>
 </head>
 <body>
     <div id='myMap' style='width:660px;height:600px'>
     </div>
 </body>
</html>