Summary
Constructor
new Bar(center, value, options)
Parameters:
Name | Type | Description | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
center |
module:basetype~Coordinate | 该Bar放置的中心点坐标,必需。 |
||||||||||||
value |
Number | Bar代表的统计值,大于0时有效,若不提供或小于等于0,则按0处理。 |
||||||||||||
options |
Object | 其他设置项,可选。
|
Throws:
当参数类型不正确时,方法内部报错。
Example
//创建barCell
const barCell=new hmap.geosolution.cell.Bar(center,100,{
colorB:new hmap.style.Color(255,200,10,1),
colorT:new hmap.style.Color(0,255,20,1)
});
Methods
-
destroy()
-
销毁对象,如果元素已经添加到其模型,需要先从模型中移除后再销毁
-
getId() → {String}
-
获取对象的唯一标识符
Returns:
String -对象的唯一标识符
-
getText() → {Object}
-
获取显示文本,包括样式
Returns:
Object -
setColor(color, isTop)
-
设置颜色
Parameters:
Name Type Default Description color
module:style~Color 颜色
isTop
Boolean false 是否是柱体Bar的顶端颜色。默认为false,代表设置为柱体Bar的底端颜色
Example
//设置顶部颜色 barCell.setColor(new hmap.style.Color(0,20,240,1),true);
-
setText(textStyle)
-
设置显示文本,包括样式
Parameters:
Name Type Description textStyle
Object Name Type Description fontSize
Number 文字大小,默认18
fontColor
module:style~Color 文字颜色,默认红色
haloColor
module:style~Color 边框颜色,默认绿色
haloWidth
Number 边框大小,默认0
offset
moduel:basetype~Offset 文字相对于锚点偏移,像素单位,默认new Offset(0,0)
rotate
Number 旋转角度(绕锚点),单为度,默认0
rowTextCount
Number 换行字符个数,默认6
letterSpace
Number 字符间距,单为像素
lineHeight
Number 行高,单为像素
weight
String | Number 文字加粗,支持"normal"(默认),"lighter","bold","bolder",或权重数值
justify
String 文字居中类型 "center"(默认),"right","left"
anchor
String 锚点在文字整体的位置,支持"center"(默认),"right","top","bottom","left","top-left","top-right","bottom-left","bottom-right"