YouTube | Facebook | X(Twitter) | RSS

バー チャート レンダラー

2016/9/1 (木)

'IBarChartSymbol Interface サンプル
Private Function ChartReturnRender() As IChartRenderer
 
  'The largest value of all bars.
  Dim dmaxValue As Double
  dmaxValue = 878056 '統計情報で求めるレコード値の最大値
 
  'Set up the chart marker symbol to use with the renderer
  Dim pBarChartSymbol As IBarChartSymbol, pFillSymbol As IFillSymbol
  Dim pMarkerSymbol As IMarkerSymbol, pSymbolArray As ISymbolArray
  Dim pChartSymbol As IChartSymbol, pChartRenderer As IChartRenderer
  Dim pRendererFields As IRendererFields
 
 
  'Create a new bar chart symbol
  Set pBarChartSymbol = New BarChartSymbol
  'Set the width of each bar - units are points
  pBarChartSymbol.Width = 6
  Set pMarkerSymbol = pBarChartSymbol 'QI to marker symbol interface
  Set pChartSymbol = pBarChartSymbol 'QI to chart symbol interface
  pChartSymbol.MaxValue = dmaxValue 'This is the biggest value of all bars
  pMarkerSymbol.size = 30 'This is the maximum height of the biggest bar
 
 
  Set pSymbolArray = pBarChartSymbol
  Set pFillSymbol = New SimpleFillSymbol
  pFillSymbol.Color = GetRGBColor(213, 212, 252) 'Pastel green
  pSymbolArray.AddSymbol pFillSymbol
'  Set pFillSymbol = New SimpleFillSymbol
'  pFillSymbol.Color = GetRGBColor(193, 252, 179) 'Pastel purple
'  pSymbolArray.AddSymbol pFillSymbol
  Set pChartRenderer = New ChartRenderer 'Create a new chart renderer
 
 
 
  'Set up the fields that comprise the components of a chart; a bar in
  'a bar chart or a slice of a pie chart
  Set pRendererFields = pChartRenderer
  pRendererFields.AddField "P_NUM"
'  pRendererFields.AddField "POP1990"
 
 
  'Set the chart symbol into the renderer. This could also be a stacked
  'bar or pie chart
  Set pChartRenderer.ChartSymbol = pBarChartSymbol
  Set pFillSymbol = New SimpleFillSymbol
  pFillSymbol.Color = GetRGBColor(239, 228, 190)
  Set pChartRenderer.BaseSymbol = pFillSymbol
 
 
  'Disable so that charts appear in polygon centers
  pChartRenderer.UseOverposter = False
 
 
  pChartRenderer.CreateLegend 'Create the legend symbols
  pChartRenderer.Label = "Population by Area"
     
    Set ChartReturnRender = pChartRenderer
 
End Function
 
Private Function GetRGBColor(pRed As Long, pGreen As Long, _
                             pBlue As Long) As IRgbColor
    Dim pRGB As IRgbColor
    Set pRGB = New RgbColor
    With pRGB
        .Red = pRed
        .Green = pGreen
        .Blue = pBlue
        .UseWindowsDithering = True
    End With
    Set GetRGBColor = pRGB
End Function
  • この記事を書いた人

羽田 康祐

伊達と酔狂のGISエンジニア。GIS上級技術者、Esri認定インストラクター、CompTIA CTT+ Classroom Trainer、潜水士、PADIダイブマスター、四アマ。WordPress は 2.1 からのユーザーで歴だけは長い。 代表著書『"地図リテラシー入門―地図の正しい読み方・描き方がわかる』 GIS を使った自己紹介はこちら。ESRIジャパン(株)所属、元青山学院大学非常勤講師を兼務。日本地図学会第31期常任委員。発言は個人の見解です。

-プログラミング, ArcGIS
-,