阅读:1839回复:5
[求助]关于专题图层的问题?--谢谢
当生成饼状、或者柱状图时能不能把它的数值显示出来
怎么实现? 谢谢。。。。。<img src="images/post/smile/dvbbs/em12.gif" /> |
|
1楼#
发布于:2004-11-12 11:04
<P>既然专题都能画出来,在顶上加个文字就行了啊</P><P>除非专题的绘制过程不是自己做的。。。。</P>
|
|
2楼#
发布于:2004-11-12 12:11
arcims不支持这项功能
|
|
3楼#
发布于:2004-11-15 21:19
<P>俺倒是相信 hengyu 能够做出来!</P><P>怎么样给大家露一手吧。</P><img src="images/post/smile/dvbbs/em02.gif" /><img src="images/post/smile/dvbbs/em02.gif" />
|
|
|
4楼#
发布于:2004-11-25 13:48
<P>附上我年初写的一个实现柱状专题的专题类,此类运行成功。但该类当时有很多操作上的问题,后来就放弃了,用vml在客户端重写了,后来客户又取消了此功能,所以vml的计划也不了了之,现附上此源码,屏蔽了部分涉及商业问题的东西,希望对大家编写此类功能有所启发,此版本没有扩展文字,只有图,但这应该不是最大的问题吧,欢迎交流。这是asp的vbscript写的专题类,功能很简单,只有一个柱状功能。</P><P><%
'*********************************************** '编写人: *** '代码完成时间: 2004-2-11 '版权所有:*** '***********************************************</P><P> '*********************************************** '维护人: *** '代码修改时间: 2004-2-13 '版权所有: *** '***********************************************</P><P>'*********************************************** '主题: 针对WEBGIS的专题图:GISTheme类 '使用范围: ***系统 '版本: V0.0.2 '完成内容: 单级记录的柱状专题图 '最近修改内容: 设定基准值,取消Math类 '***********************************************</P><P>DIM COLOR_ARRAY(5) '预定义颜色组合 COLOR_ARRAY(0) = "#919FBD,#EEECF7,#274686,#94AAD7" COLOR_ARRAY(1) = "#EEEAE7,#3F6B32,#F0FEE5,#85F164"</P><P>Class GISTheme</P><P> '///属性定义 '------------------------------------------------------------------------ '颜色组合解决方案:为实现专题图的换肤效果,采用动态颜色组合方案 '以逗号作为分隔符号将颜色信息存入sArrayColor,此属性也是自定义颜色接口 'v0.0.1版本: Color数组代表含义 ' [0]专题图边框[1]专题图背景[2]专题图X、Y、柱型边框[3]条形背景 '------------------------------------------------------------------------ Private sArrayColor '所用到的颜色序列集合 Private aColor '解析需要应用的颜色组合为颜色数组 Private sThemeColor '专题图每个柱型颜色集合 Private aTColor '柱型颜色数组 '动态图层的设置 Private iLayerWidth 'Layer图层的宽度 Private iLayerHeight 'Layer图层的高度 Private iLayerTop 'Layer图层Top位置 Private iLayerLeft 'Layer图层Left位置 Private iZIndex 'Layer图层的z-Index '专题图用参数 Private iThemeWidth '专题柱状的宽度 Private sArrayValue '用做专题图的ArrayValue值 Private aValue 'ArrayValue数组 '图例参数设置 Private sLegendBgColor '图例背景色 Private sTitleBgColor '图例标题背景色 Private sLegendBorderColor '边框色调 Private sArrayLegendName '图例各项名称集合 Private aLegendName '图例名称数组 Private iLegendRect '图例的矩形大小 '设定基准值的目的:为保证地图上多个图表之间的关联关系,都以iBaseValue作为基准值,基准值的象素高度为iBaseHeight '所有专题数据均根据此值比例获得实际象素高度 Private iBaseValue '基准值 Private iBaseHeight '基准高度 Private aValueToHeight '将aValue数组转为对应高度的数组 'VBScript类不能创建构造函数?? '参数初始化,默认初始值,需显式调用,以替代构造函数功能 Sub INIT() sArrayColor = COLOR_ARRAY(0) iLayerWidth = 250 iLayerTop = 50 iLayerLeft = 80 iZIndex = 2 iBaseValue = 10 iBaseHeight = 15 iThemeWidth = 14 sThemeColor = "#CCFA83,#FFE3BE,#BDB2B5,#5BA770,#22E5B5,#D460FF,#FF9AC5,#FF6637" sLegendBgColor = "#F1F3FD" sTitleBgColor = "#EAEFFF" sLegendBorderColor = "#89A3C3" iLegendRect = 10 End Sub '在地图上生成表格 Function TableOnMapSet(objID) Dim sHTML Dim i Dim aValue Dim oMath Dim aTColor aColor = split(sArrayColor,",") '专题图所用数据 aValue = split(sArrayValue,",") sHTML = "<div id='" ; objID ; "' style='position:absolute;z-index:2;left:" ; iLayerLeft ;_ ";top:" ; iLayerTop ; ";width:" ; iLayerWidth ; ";filter:Alpha(Opacity=90);'>" '开始画专题图 sHTML = sHTML ; "<table border=0 cellspacing=0 cellpadding=0>" '生成Y坐标 sHTML = sHTML ; "<tr><td rowspan=2 bgcolor='" ; aColor(2) ; "' width=1>" ;_ "<td>" '画专题柱状图 aTColor = split(sThemeColor,",") sHTML = sHTML ; "<table border=0 cellspacing=0 cellpadding=0><tr>" Call SetValueToHeight '以循环表格方式画每个具体的条形图 For i=0 To UBound(aValue) sHTML = sHTML ; "<td width='" ; iThemeWidth ; "' align=center valign=bottom>" ;_ SetRectTable(aColor(2),aTColor(i),aValueToHeight(i),Int(iThemeWidth)) ;_ "</td>" Next sHTML = sHTML ; "</tr></table>" '生成X坐标 sHTML = sHTML ; "<tr><td bgcolor='" ; aColor(2) ; "' height=1>" ;_ "</tr>" ;_ "</table>" ;_ "</div>" TableOnMapSet = sHTML End Function ' 柱状表的生成 Function SetRectTable(sColorBorder,sBgColor,iHeight,iWidth) Dim sHTML Dim iHgt Dim iWdt iHgt = iHeight iWdt = iWidth sHTML = "<table border=0 cellspacing=0 cellpadding=0 width=" ; iWdt ;_ " height=" ; iHgt ; ">" ;_ "<tr><td rowspan=2 width=1 bgcolor=" ; sColorBorder ; ">" ;_ "<td height=1 bgcolor='" ; sColorBorder ; "'>" ;_ "<td rowspan=2 width=1 bgcolor=" ; sColorBorder ; ">" ;_ "<tr><td height=" ; iHgt-1 ; " width=" ; iWdt-2 ; " bgcolor='" ; sBgColor ; "'>" ;_ "</tr>" ;_ "</table>" SetRectTable = sHTML End Function '将数组的值转化为象素高度并保存在aValueToHeight数组中 Sub SetValueToHeight() Dim i aValue = Split(sArrayValue,",") Redim aValueToHeight(UBound(aValue)) For i = 0 To UBound(aValue) aValueToHeight(i) = CInt((aValue(i)/iBaseValue)*iBaseHeight) Next End Sub '建立专题图图例 Function SetThemeLegend(sDIVID,iLayerLeft,iLayerTop) Dim sHTML aLegendName = Split(sArrayLegendName,",") aTColor = split(sThemeColor,",") sHTML = "<DIV id=" ; sDIVID ; " style='position:absolute;z-index:2;top:" ; iLayerTop ; ";left:" ; iLayerLeft ; ";width:100'>" sHTML = sHTML ; "<table border=0 cellspacing=1 cellpadding=0 width='100%' bgcolor='" ; sLegendBorderColor ; "'><tr><td bgcolor='" ; sLegendBgColor ; "'>" sHTML = sHTML ; "<table border=0 cellspacing=0 cellpadding=0 width='100%'>" sHTML = sHTML ; "<tr><td colspan=2 bgcolor='" ; sTitleBgColor ; "' align=center valign=middle height=25>专题图例</td></tr>" sHTML = sHTML ; "<tr><td colspan=2 height=1 bgcolor='" ; sLegendBorderColor ; "'></td></tr>" '循环画每一个图例 FOR i = 0 TO UBound(aLegendName) sHTML = sHTML ; "<tr><td width=40 height=25 align=center valign=middle>" sHTML = sHTML ; "<table border=0 cellspacing=1 cellpadding=0 bgcolor='#4A5484'>" sHTML = sHTML ; "<tr><td bgcolor='" ; aTColor(i) ; "' width=" ; iLegendRect ; " height=" ; iLegendRect ; "></td></tr></table>" sHTML =sHTML ; "<td width=160>" ; aLegendName(i) ; "</td></tr>" Next sHTML = sHTML ; "</table>" sHTML = sHTML ; "</table>" sHTML = sHTML ; "</DIV>" SetThemeLegend = sHTML End Function '//属性设置 Public Property Let ArrayColor(sColor) sArrayColor = sColor End Property Public Property Get ArrayColor() ArrayColor = sArrayColor End Property Public Property Let LayerWidth(iWidth) iLayerWidth = iWidth End Property Public Property Get LayerWidth() LayerWidth = iLayerWidth End Property Public Property Let LayerTop(iTop) iLayerTop = iTop End Property Public Property Get LayerTop() LayerTop = iLayerTop End Property Public Property Let LayerLeft(iLeft) iLayerLeft = iLeft End Property Public Property Get LayerLeft() LayerLeft = iLayerLeft End Property Public Property Let ArrayValue(value) sArrayValue = value End Property Public Property Get ArrayValue() ArrayValue = sArrayValue End Property Public Property Let BaseValue(value) iBaseValue = value End Property Public Property Get BaseValue() BaseValue = iBaseValue End Property Public Property Let BaseHeight(value) iBaseHeight = value End Property Public Property Get BaseHeight() BaseHeight = iBaseHeight End Property Public Property Let ArrayLegendName(value) sArrayLegendName = value End Property Public Property Get ArrayLegendName() ArrayLegendName = sArrayLegendName End Property Public Property Let ThemeWidth(value) iThemeWidth = value End Property Public Property Get ThemeWidth() ThemeWidth = iThemeWidth End Property Public Property Let LegendRect(value) iLegendRect = value End Property Public Property Get LegendRect() LegendRect = iLegendRect End Property End Class</P><P> '针对数组的基本运算 'Class Math ' Private sValue ' Private aValue ' Public aValuePercent() ' ' Function Avg() ' Avg = Sum()/UBound(aValue) ' End Function ' ' Function Sum() ' Dim i ' Sum = 0 ' For i=0 To UBound(aValue) ' Sum = Sum + aValue(i) ' Next ' End Function ' Function Max() ' Max = 0 ' Dim i ' For i=0 To UBound(aValue) ' If CDbl(aValue(i))>Max Then ' Max = CDbl(aValue(i)) ' End If ' Next ' End Function ' ' Sub SplitValue() ' aValue = split(sValue,",") ' End Sub ' ' Sub PercentValue() ' Dim i ' Redim aValuePercent(UBound(aValue)) ' For i=0 To UBound(aValue) ' aValuePercent(i) = aValue(i)/Max() ' Next ' End Sub ' ' Public Property Let ArrayData(value) ' sValue = value ' End Property ' Public Property Get ArrayData() ' ArrayData = sValue ' End Property 'End Class</P><P>%></P> |
|
5楼#
发布于:2004-11-30 13:52
<P>高</P><P>真高</P><P>~~~~~</P><P>晚上回去弄看看</P>
|
|
|