Class: Choropleth

.Visuals.MapV. Choropleth

基于MapV的分级统计图层

new Choropleth()

Author:
  • kz
Source:
View2D/Visuals/MapV/Choropleth.js
Example
//构造MapV可视化图层
 var mapV = new GeoGlobe.Visuals.MapV();
 //添加到地图中
 mapV.addTo(map);
 //构造分级统计图层
 var choropleth = new GeoGlobe.Visuals.MapV.Choropleth({
    id: 'choropleth_1',
    visibility: true,
    dragdrawing: true,
    data: [{
        "type": "Feature",
        "properties": {"id": "13", "name": "河北", "cp": [115.4004, 37.9688], "childNum": 11, "count": 48.53010858521839},
        "geometry": {
            "type": "MultiPolygon",
            "coordinates": [[[[114.5215, 39.5068], [114.3457, 39.8584], [113.9941, 39.9902], [114.5215, 40.3418], [114.3457, 40.3857], [114.2578, 40.6055], [114.082, 40.7373], [113.9063, 41.1328], [113.9941, 41.2207], [113.9063, 41.4404], [114.2578, 41.5723], [114.1699, 41.792], [114.5215, 42.1436], [114.873, 42.0996], [114.9609, 41.6162], [115.2246, 41.5723], [115.9277, 41.9238], [116.0156, 41.792], [116.2793, 42.0117], [116.8066, 42.0117], [116.8945, 42.4072], [117.334, 42.4512], [117.5098, 42.583], [117.7734, 42.627], [118.0371, 42.4072], [117.9492, 42.2314], [118.125, 42.0557], [118.3008, 42.0996], [118.3008, 41.792], [118.125, 41.748], [118.3887, 41.3086], [119.2676, 41.3086], [118.8281, 40.8252], [119.2676, 40.5176], [119.5313, 40.5615], [119.707, 40.1221], [119.8828, 39.9463], [119.5313, 39.6826], [119.4434, 39.4189], [118.916, 39.0674], [118.4766, 38.9355], [118.125, 39.0234], [118.0371, 39.1992], [118.0371, 39.2432], [117.8613, 39.4189], [117.9492, 39.5947], [117.6855, 39.5947], [117.5098, 39.7705], [117.5098, 39.9902], [117.6855, 39.9902], [117.6855, 40.0781], [117.4219, 40.21], [117.2461, 40.5176], [117.4219, 40.6494], [116.9824, 40.6934], [116.6309, 41.0449], [116.3672, 40.9131], [116.4551, 40.7813], [116.1914, 40.7813], [116.1035, 40.6055], [115.752, 40.5615], [115.9277, 40.2539], [115.4004, 39.9463], [115.4883, 39.6387], [115.752, 39.5068], [116.1914, 39.5947], [116.3672, 39.4629], [116.543, 39.5947], [116.8066, 39.5947], [116.8945, 39.1113], [116.7188, 38.9355], [116.7188, 38.8037], [117.2461, 38.54], [117.5977, 38.6279], [117.9492, 38.3203], [117.4219, 37.8369], [116.8066, 37.8369], [116.4551, 37.4854], [116.2793, 37.5732], [116.2793, 37.3535], [116.0156, 37.3535], [115.752, 36.9141], [115.3125, 36.5186], [115.4883, 36.167], [115.3125, 36.0791], [115.1367, 36.2109], [114.9609, 36.0791], [114.873, 36.123], [113.7305, 36.3428], [113.4668, 36.6504], [113.7305, 36.8701], [113.7305, 37.1338], [114.1699, 37.6611], [113.9941, 37.7051], [113.8184, 38.1445], [113.5547, 38.2764], [113.5547, 38.54], [113.8184, 38.8037], [113.8184, 38.9355], [113.9063, 39.0234], [114.3457, 39.0674], [114.5215, 39.5068]]], [[[117.2461, 40.0781], [117.1582, 39.8145], [117.1582, 39.6387], [116.8945, 39.6826], [116.8945, 39.8145], [116.8066, 39.9902], [117.2461, 40.0781]]]]
        }
    }, {
        "type": "Feature",
        "properties": {"id": "42", "name": "湖北", "cp": [112.2363, 31.1572], "childNum": 17, "count": 35.46388778327547},
        "geometry": {
            "type": "Polygon",
            "coordinates": [[[110.2148, 31.1572], [110.127, 31.377], [109.6875, 31.5527], [109.7754, 31.6846], [109.5996, 31.7285], [109.5117, 32.4316], [109.6875, 32.6074], [110.127, 32.6074], [110.127, 32.7393], [109.7754, 32.915], [109.7754, 33.0469], [109.4238, 33.1348], [109.5996, 33.2666], [110.3027, 33.1787], [110.5664, 33.2666], [110.7422, 33.1348], [111.0059, 33.2666], [111.5332, 32.6074], [112.3242, 32.3438], [113.2031, 32.4316], [113.4668, 32.2998], [113.7305, 32.4316], [113.8184, 31.8604], [113.9941, 31.7725], [114.1699, 31.8604], [114.5215, 31.7725], [114.6094, 31.5527], [114.7852, 31.4648], [115.1367, 31.5967], [115.2246, 31.4209], [115.4004, 31.4209], [115.5762, 31.2012], [116.0156, 31.0254], [115.752, 30.6738], [116.1035, 30.1904], [116.1035, 29.8389], [115.9277, 29.707], [115.4883, 29.7949], [114.873, 29.3994], [114.2578, 29.3555], [113.9063, 29.0479], [113.7305, 29.0918], [113.6426, 29.3115], [113.7305, 29.5752], [113.5547, 29.707], [113.5547, 29.8389], [113.0273, 29.4434], [112.9395, 29.4873], [113.0273, 29.751], [112.9395, 29.7949], [112.6758, 29.5752], [112.5, 29.6191], [112.2363, 29.5313], [111.7969, 29.9268], [110.8301, 30.1465], [110.4785, 30.0146], [110.6543, 29.751], [110.4785, 29.6631], [109.7754, 29.751], [109.6875, 29.6191], [109.5117, 29.6191], [109.248, 29.1357], [109.0723, 29.3555], [108.9844, 29.3115], [108.6328, 29.8389], [108.457, 29.7949], [108.5449, 30.2344], [108.457, 30.4102], [108.6328, 30.5859], [108.8086, 30.498], [109.0723, 30.6299], [109.1602, 30.542], [109.248, 30.6299], [109.4238, 30.542], [109.8633, 30.8936], [110.0391, 30.8057], [110.2148, 31.1572]]]
        }
    }],
    rendererOptions: {
        splitList: [
            {
                start: 0,
                end: 10,
                value: '#f1eef6'
            },{
                start: 10,
                end: 20,
                value: '#d5bad9'
            },{
                start: 20,
                end: 30,
                value: '#cc97c7'
            },{
                start: 30,
                end: 40,
                value: '#e469af'
            },{
                start: 40,
                end: 50,
                value: '#ee3387'
            },{
                start: 50,
                end: 60,
                value: '#d61e53'
            },{
                start: 60,
                value: '#960b3d'
            }
        ],
        globalAlpha: 0.8
    }
 });
 //添加到MapV可视化图层
 choropleth.addTo(mapV);
 //绘制
 mapV.render();

Members


visibility :Boolean

图层可见性
Type:
  • Boolean
Default Value:
  • true
Source:
View2D/Visuals/MapV/Choropleth.js

Methods


addTo(mapV)

关联mapV
Parameters:
Name Type Description
mapV GeoGlobe.Visuals.MapV
Source:
View2D/Visuals/MapV/Choropleth.js

destroy()

销毁图层
Source:
View2D/Visuals/MapV/Choropleth.js

remove()

从父对象中移除自己
Source:
View2D/Visuals/MapV/Choropleth.js

render()

绘制
Source:
View2D/Visuals/MapV/Choropleth.js

setData(data)

数据的处理
Parameters:
Name Type Description
data Array 数据,geojson格式
Source:
View2D/Visuals/MapV/Choropleth.js

setVisible(visibility)

图层的显示与隐藏
Parameters:
Name Type Description
visibility Boolean 可见性
Source:
View2D/Visuals/MapV/Choropleth.js