YouTube | Facebook | Twitter  Feed

バー チャート レンダラー

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


  • この記事を書いた人

羽田 康祐

Esri認定インストラクター、GIS上級技術者、測量士補、潜水士。GISy / GISc とその関連分野である地理学・地図学について日々の出来事で学んだ記憶を記録するためにブログを書いています。行動原理は伊達と酔狂。好きな地形は圏谷。好きな地図投影法はパースクインカンシャル図法とマクブライドトーマス四次平極図法。広島県呉市生まれ広島市出身。GIS を使った自己紹介はこちら

-プログラミング, ArcGIS

© 2021 WINGFIELD since1981