Class: Scatter

.Visuals.Custom. Scatter

地域分布(散点)图层

new Scatter(options)

Parameters:
Name Type Description
options Object
Properties
Name Type Description
id String 图层id
data Array 数据,geojson格式
visibility Boolean 图层默认是否显示
legend Object 图例配置
Properties
Name Type Description
show Boolean 是否显示图例
title String 图例标题
left Number 距左边界的距离
right Number 距右边界的距离
top Number 距上边界的距离
bottom Number 距下边界的距离
col Number 图例项的列数
itemSize Number 图例项图形大小
itemColors Array 图例项图形颜色集
itemStatuses Array 图例项启用状态,0表示未启用、1表示启用
backgroundColor String 背景颜色
borderColor String 边框颜色
borderWidth Number 边框线宽
borderRadius Number 边框圆角
shadowColor String 阴影颜色
shadowBlur Number 阴影模糊度
shadowOffsetX Number 阴影水平偏移量
shadowOffsetY Number 阴影垂直偏移量
padding Number 内边距
textStyle String 文字样式
Properties
Name Type Description
color String 颜色
fontFamily String 字体系列
fontSize Number 字号 ,单位px
fontStyle String 样式,可选为:'normal' | 'italic' | 'oblique'
fontWeight String | Number 粗细,可选为:'normal' | 'bold' | 'bolder' | 'lighter' | 100 | 200 |... | 900
rendererOptions Object 渲染配置
Properties
Name Type Description
markPoint Object 标注
Properties
Name Type Description
unactivatedDrawable Boolean 是否绘制未激活状态的标注,为true时以灰色调进行绘制
symbol String 标注图形类型,可选为:'square' | 'round' | 'square2'
symbolSize Number 标注大小
itemStyle Object 图形样式属性
Properties
Name Type Description
color String 颜色
shadowColor String 阴影颜色
shadowBlur Number 阴影模糊度
shadowOffsetX Number 阴影偏移量X
shadowOffsetY Number 阴影偏移量Y
Author:
  • kz
Source:
View2D/Visuals/Custom/Scatter.js
Example
//构造地图对象
 var map = new GeoGlobe.Map({
    style: Cfg.style,
    container: 'map',
    zoom: 16,
    bearing: 0,
	pitch: 0,
    units: "degrees",
    center: [114.20509630753577, 30.776055193053764]
 });
 //构造可视化定制图层
 var custom = new GeoGlobe.Visuals.Custom();
 //添加到地图中
 custom.addTo(map);
 //通过jquery加载json数据
 $.getJSON('../../data/xuzhou.json', function (result) {
    //构造地域分布(散点)图层
    var scatter = new GeoGlobe.Visuals.Custom.Scatter({
        id: "scatter_1",
        data: result.features,
        visibility: true,
        legend:{
            show: true,
            left: 10,
            top: 10,
            col: 1,
            itemSize: 10,
            itemColors: ["#4f19c7","#c71969","#1984c7","#8419c7","#c76919","#c78419","#199fc7","#9f19c7",
                "#69c719","#b9c719","#3419c7","#19b9c7","#19c74f","#c79f19","#19c7b9","#34c719",
                "#FFD7AA","#8DD7FF","#FFD766"],
            itemStatuses: [1,0,0,0,0,1,1,0,0,0,0,0,0,0,0,1,0,0,0],
            padding: 5
        },
        rendererOptions: {
            markPoint: {
                unactivatedDrawable: false,
                symbol: 'square',
                symbolSize: 1
            }
        }
    });
    //添加到可视化定制图层
    scatter.addTo(custom);
    //绘制
    custom.render();
 });

Members


cacheCanvas :Array

离屏画布集合
Type:
  • Array
Source:
View2D/Visuals/Custom/Scatter.js

cacheCanvasContext :Array

离屏画布的上下文集合
Type:
  • Array
Source:
View2D/Visuals/Custom/Scatter.js

canvas :Array

画布集合,使用分层画布分别绘制
Type:
  • Array
Source:
View2D/Visuals/Custom/Scatter.js

canvasContext :Array

画布的上下文集合
Type:
  • Array
Source:
View2D/Visuals/Custom/Scatter.js

legendLabels :Array

图例标签名数组
Type:
  • Array
Source:
View2D/Visuals/Custom/Scatter.js

MarkPointsSet :function

标注对象集类
Type:
  • function
Source:
View2D/Visuals/Custom/Scatter.js

markPointsSets :Array

标注对象集
Type:
  • Array
Source:
View2D/Visuals/Custom/Scatter.js

visibility :Boolean

图层默认是否显示
Type:
  • Boolean
Source:
View2D/Visuals/Custom/Scatter.js

Methods


addTo(custom)

关联可视化定制图层对象
Parameters:
Name Type Description
custom GeoGlobe.Visuals.Custom
Source:
View2D/Visuals/Custom/Scatter.js

clearCanvas()

画布清空
Source:
View2D/Visuals/Custom/Scatter.js

destroy()

销毁图层
Source:
View2D/Visuals/Custom/Scatter.js

draw()

图层绘制
Source:
View2D/Visuals/Custom/Scatter.js

drawCanvas()

绘制标注集到画布
Source:
View2D/Visuals/Custom/Scatter.js

drawLegend(index)

绘制图例
Parameters:
Name Type Description
index Number 当前绘制的类型索引
Source:
View2D/Visuals/Custom/Scatter.js

lazydraw()

图层懒绘制
Source:
View2D/Visuals/Custom/Scatter.js

onMove()

图层(地图)移动时触发
Source:
View2D/Visuals/Custom/Scatter.js

onMoveEnd()

图层(地图)移动结束触发
Source:
View2D/Visuals/Custom/Scatter.js

onResize()

图层自适应
Source:
View2D/Visuals/Custom/Scatter.js

redraw()

图层重绘
Source:
View2D/Visuals/Custom/Scatter.js

render()

渲染图层
Source:
View2D/Visuals/Custom/Scatter.js

setData(data)

数据的处理,构造标注对象集对象
Parameters:
Name Type Description
data Array 数据
Source:
View2D/Visuals/Custom/Scatter.js

setVisible(visibility)

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

stopDraw()

停止绘制
Source:
View2D/Visuals/Custom/Scatter.js

updateXY()

重新计算标注集的屏幕坐标
Source:
View2D/Visuals/Custom/Scatter.js