历史版本1 :地图自定义标签位置 返回文档
编辑时间: 内容长度:图片数:目录数: 修改原因:

目录:

1、问题描述编辑

我们在日常使用地图过程中,通常会遇到地图标签,提示点等显示不满足我们的需求,需要进行js代码编写。

对于新使用FR的用户,通常不知道如何进行js代码编写方式。而且,在使用地图过程中,我们会发现“内蒙古、黑、

龙江等”地名显示的位置偏离。这时候我们都需要使用js进行调控。在此,提供一些简单的js参考范本。


222


2、示例编辑

1)自定义js显示标签提示

在如图2所示位置进行js添加:


222

function(){

var points = this.points; var total = '<div style="width:100%;height:100%;">';

if(this.name=="内蒙古自治区"){total += '<div align=center style="border:solid red 0px;margin-top:250px"><span style="font-size:25px;color:'+FR.contentFormat(points[3].value, '')+'">'+FR.contentFormat(points[2].value, '')+'</span>'+this.name+'</div>';}//当读取名字为内蒙古自治区时候,我们进行margin显示位置的调整,使其不显示偏离

else if(this.name=="黑龙江省"){total += '<div align=center style="border:solid red 0px;margin-top:100px;"><span style="font-size:25px;color:'+FR.contentFormat(points[3].value, '')+'">'+FR.contentFormat(points[2].value, '')+'</span>'+this.name+'</div>';}else{total += '<div align=center style="border:solid red 0px;"><span style="font-size:25px;color:'+FR.contentFormat(points[3].value, '')+'">'+FR.contentFormat(points[2].value, '')+'</span>'+this.name+'</div>';}for(var i = 0, len = points.length-2; i < len; i++) {total += ('<div  align=center>'+FR.contentFormat(points[i].value, '#0.00')+'</div>'); } total+='</div>'; return total;}

2)自定义提示点js

function(){var points = this.points ;var total = '<div style="width:100%;background-color:#808080;color:white">';

total +='<div align=left style="font-size:16px">'+this.name+'</div>';for(var i = 0, len = points.length-1; i < len; i++)

{total +='<div align=left style="font-size:13px">●'+points[i].seriesName+':'+FR.contentFormat(points[i].value, '#0.00')+'</div>';}//此处做一个简单的循环,循环展示我们前端设置的参数,并对参数做单独的处理,包括控制字体大小,以及显示格式

return total;}

3、运行环境编辑

操作系统:Windows 7旗舰版

服务器:Windows server 2008

FR版本 8.0

数据库: SQLServer2008