比例尺控件中的标签是否可以使用中文

在使用Scalebar时,怎样将比例尺单位由英文修改成中文,如km转换成千米?
已邀请:

谢军

赞同来自:

【解决办法】:
scalebar没有进行汉化,只能通过找到对应dom元素,更改其文字内容。 主要代码请参考:

map.on(load, changeLabel);

map.on(extent-change, changeLabel);

map.on(mouse-drag, changeLabel);

function changeLabel() {

var preLabel = \$(.esriScaleLabelDiv div:first).html();

if (preLabel.substring(preLabel.length - 2) == km) {

\$(.esriScaleLabelDiv div:first).html(preLabel.substring(0, preLabel.length - 2) + 千米);
}
else {

\$(.esriScaleLabelDiv div:first).html(preLabel.substring(0, preLabel.length - 1) + 米);
}
}

要回复问题请先登录注册