'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
バー チャート レンダラー
2016/9/1 (木)