geosolution/cell~Sector(options)

饼状图模型的构成元素。扇形。

Summary

Methods:
destroy

销毁对象,如果元素已经添加到其模型,需要先从模型中移除后再销毁

getId

获取该对象唯一标识符

getText

获取显示文本,包括样式

getValue

获取该对象代表的统计值

setColor

设置该对象颜色值

setText

设置显示文本,包括样式

Constructor

new Sector(options)

Parameters:
Name Type Description
options Object

设置项。

Name Type Description
color module:style~Color

扇形的颜色。默认值new hmap.style.Color(255,0,0,1)。

value Number

扇形代表的统计值,必需。

textStyle Object

文字标注,参考Sector#setText

Throws:

options.color无参数校验,参数类型错误,方法内部报错。options.value非Number或小于等于0。

Example
let sector=new hmap.geosolution.cell.Sector({
     color:new hmap.style.Color(200,0,0,1),
     value:500,
});

Methods

destroy()

销毁对象,如果元素已经添加到其模型,需要先从模型中移除后再销毁

getId() → {String}

获取该对象唯一标识符

Returns:
String -

对象的唯一标识符

getText() → {Object}

获取显示文本,包括样式

Returns:
Object

getValue() → {Number}

获取该对象代表的统计值

Returns:
Number -

该扇形代表的统计值

setColor(color)

设置该对象颜色值

Parameters:
Name Type Description
color module:style~Color

颜色值

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"