flywoo2002
路人甲
路人甲
  • 注册日期2004-06-24
  • 发帖数13
  • QQ
  • 铜币212枚
  • 威望0点
  • 贡献值0点
  • 银元0个
阅读:1831回复:5

问高手关于饼状图的画法[求助]

楼主#
更多 发布于:2005-08-23 17:14
<P>请教大家:怎么做这样的一个饼</P>
<P><BR></P>
喜欢0 评分0
flywoo2002
路人甲
路人甲
  • 注册日期2004-06-24
  • 发帖数13
  • QQ
  • 铜币212枚
  • 威望0点
  • 贡献值0点
  • 银元0个
1楼#
发布于:2005-08-23 17:15
本人愚钝加上资料不全,这个问题已经困扰了我好几天了~~
举报 回复(0) 喜欢(0)     评分
gis
gis
管理员
管理员
  • 注册日期2003-07-16
  • 发帖数15947
  • QQ554730525
  • 铜币25339枚
  • 威望15364点
  • 贡献值0点
  • 银元0个
  • GIS帝国居民
  • 帝国沙发管家
  • GIS帝国明星
  • GIS帝国铁杆
2楼#
发布于:2005-08-23 17:52
<P>帮助里的</P>
<H1>IPieChartSymbol Example</H1><PRE><PRE><br>
<P>Paste this VBA code into a map with at least one feature layer:  Creates a <B>PieChartRenderer</B>, sets its properties, applies it to the <STRONG>GeoFeatureLayer</STRONG>, and refreshes the map. </P><PRE>Option Explicit</PRE><PRE> </PRE><PRE>Private Sub PieChartRenderer()</PRE><PRE>    '** Paste into VBA<BR>    '** Creates a PieChartRenderer and applies it to first layer in the map.<BR>    '** First Layer in the map is the "States" feature class from ESRI's sample data<BR>    '** Layer must have "POP1990" field</PRE><PRE>  Const strPopField1 = "POP1990"<BR>  Dim pMxdoc As IMxDocument<BR>  Dim pMap As IMap<BR>  Dim pLayer As ILayer<BR>  Dim pFeatLayer As IFeatureLayer<BR>  Dim pFClass As IFeatureClass<BR>  Dim pGeoFeatureLayer As IGeoFeatureLayer</PRE><PRE>  Set pMxdoc = ThisDocument<BR>  Set pMap = pMxdoc.FocusMap<BR>  Set pLayer = pMap.Layer(0)<BR>  Set pFeatLayer = pLayer<BR>  Set pGeoFeatureLayer = pFeatLayer<BR>  Set pFClass = pFeatLayer.FeatureClass<BR>  <BR>  Dim pChartRenderer As IChartRenderer<BR>  Dim pRendererFields As IRendererFields<BR>  Dim pPieChartRenderer As IPieChartRenderer<BR>  <BR>  Set pChartRenderer = New ChartRenderer<BR>  <BR>  ' Set up the field to draw charts<BR>  Set pRendererFields = pChartRenderer<BR>  pRendererFields.AddField strPopField1<BR>  Set pPieChartRenderer = pChartRenderer<BR>    <BR>  ' Calculate the max value of the data field to scale the chart<BR>  Dim pTable As ITable<BR>  Dim pCursor As ICursor<BR>  Dim pQueryFilter As IQueryFilter<BR>  Dim pRow As IRowBuffer<BR>  <BR>  Set pTable = pGeoFeatureLayer<BR>  Set pQueryFilter = New QueryFilter<BR>  pQueryFilter.AddField strPopField1<BR>  Set pCursor = pTable.Search(pQueryFilter, True)<BR>  <BR>  Dim fieldIndex As Long<BR>  Dim maxValue As Double<BR>  Dim firstValue As Boolean<BR>  Dim fieldValue As Double<BR>  <BR>  fieldIndex = pTable.FindField(strPopField1)<BR>  firstValue = True<BR>  maxValue = 0<BR>  <BR>  ' Iterate across each feature<BR>  Set pRow = pCursor.NextRow<BR>  Do While Not pRow Is Nothing<BR>      fieldValue = pRow.Value(fieldIndex)<BR>      If firstValue Then<BR>        ' Special case for the first value in a feature class<BR>        maxValue = fieldValue<BR>        firstValue = False<BR>      Else<BR>        If fieldValue > maxValue Then<BR>          ' we've got a new biggest value<BR>          maxValue = fieldValue<BR>        End If<BR>      End If<BR>    Set pRow = pCursor.NextRow<BR>  Loop<BR>  <BR>  If (maxValue <= 0) Then<BR>    MsgBox "Failed to calculate the maximum value or max value is 0."<BR>    Exit Sub<BR>  End If<BR>  <BR>  ' Set up the chart marker symbol to use with the renderer<BR>  Dim pPieChartSymbol As IPieChartSymbol<BR>  Dim pFillSymbol As IFillSymbol<BR>  Dim pMarkerSymbol As IMarkerSymbol<BR>  Dim pSymbolArray As ISymbolArray<BR>  Dim pChartSymbol As IChartSymbol<BR>   <BR>  Set pPieChartSymbol = New PieChartSymbol<BR>  Set pChartSymbol = pPieChartSymbol<BR>  pPieChartSymbol.Clockwise = True<BR>  pPieChartSymbol.UseOutline = True<BR>  Dim pOutline  As ILineSymbol<BR>  Set pOutline = New SimpleLineSymbol<BR>  pOutline.Color = GetRGBColor(255, 0, 255)<BR>  pOutline.Width = 1<BR>  pPieChartSymbol.Outline = pOutline</PRE><PRE>  Set pMarkerSymbol = pPieChartSymbol<BR>  <BR>  ' Finally we've got the biggest value, set this into the symbol<BR>  pChartSymbol.maxValue = maxValue<BR>  <BR>  ' This is the maximum height of the bars<BR>  pMarkerSymbol.size = 16<BR>  <BR>  Set pSymbolArray = pPieChartSymbol<BR>  Set pFillSymbol = New SimpleFillSymbol<BR>  ' This is a pastel purple<BR>  pFillSymbol.Color = GetRGBColor(213, 212, 252)<BR>  pFillSymbol.Outline = pOutline<BR>  pSymbolArray.AddSymbol pFillSymbol</PRE><PRE>  ' set up the background symbol to use tan color<BR>  Set pFillSymbol = New SimpleFillSymbol<BR>  pFillSymbol.Color = GetRGBColor(239, 228, 190)<BR>  Set pChartRenderer.BaseSymbol = pFillSymbol<BR>  <BR>  ' Disable overpoaster so that charts appear in the centre of polygons<BR>  pChartRenderer.UseOverposter = False<BR>   <BR>  ' Update the renderer and refresh the screen<BR>  <BR>  pPieChartRenderer.MinSize = 6<BR>  pPieChartRenderer.MinValue = 453588<BR>  pPieChartRenderer.FlanneryCompensation = False<BR>  pPieChartRenderer.ProportionalBySum = True<BR>  <BR>  ' Now set the piechart symbol into the renderer<BR>  Set pChartRenderer.ChartSymbol = pPieChartSymbol<BR>  pChartRenderer.Label = "Population"<BR>  pChartRenderer.CreateLegend<BR>  Set pGeoFeatureLayer.Renderer = pChartRenderer<BR>  <BR>  pMxdoc.ActiveView.Refresh<BR>  pMxdoc.UpdateContents<BR>End Sub</PRE><PRE> <BR><BR>' This function returns an RGB colour object initialised with the supplied Red Green and Blue values.<BR>' All parameters range from 0 to 255 in value</PRE><PRE>Private Function GetRGBColor(yourRed As Long, yourGreen As Long, _<BR>                             yourBlue As Long) As IRgbColor<BR>  Dim pRGB As IRgbColor<BR>  <BR>  Set pRGB = New RgbColor<BR>  With pRGB<BR>    .Red = yourRed<BR>    .Green = yourGreen<BR>    .Blue = yourBlue<BR>    .UseWindowsDithering = True<BR>  End With<BR>  Set GetRGBColor = pRGB</PRE><PRE>End Function</PRE></PRE></PRE>
举报 回复(0) 喜欢(0)     评分
flywoo2002
路人甲
路人甲
  • 注册日期2004-06-24
  • 发帖数13
  • QQ
  • 铜币212枚
  • 威望0点
  • 贡献值0点
  • 银元0个
3楼#
发布于:2005-08-24 10:01
<P>总统:这个例子还是在地图上显示的,而不能直接显示,并且这个饼没有被分割</P>
举报 回复(0) 喜欢(0)     评分
xyc4276
路人甲
路人甲
  • 注册日期2004-11-25
  • 发帖数29
  • QQ
  • 铜币233枚
  • 威望0点
  • 贡献值0点
  • 银元0个
4楼#
发布于:2006-04-26 11:10
<P>顶一下,我最近也遇到了这个问题!到现在也没找到合适的方法。</P>
<P>我的做法是自己再做一个控件,将相关的内容和圆面积对应起来,我做了一个,不过显示效果不太好。</P>
举报 回复(0) 喜欢(0)     评分
JIALAN
路人甲
路人甲
  • 注册日期2005-12-20
  • 发帖数24
  • QQ
  • 铜币193枚
  • 威望0点
  • 贡献值0点
  • 银元0个
5楼#
发布于:2006-05-10 08:38
使用IDataGraph和IDataGraphProperties 这两个接口 使用IDataGraph接口中的<a href="ms-help://ESRI.ArcGIS/esriCatalog/html/IDataGraph_Attach.htm" target="_blank" >Attach</A>属性和要显示该饼状图的控件进行绑定,这里面还可以设置显示向ArcMap里面一样的所有
举报 回复(0) 喜欢(0)     评分
游客

返回顶部