forked from fossilbin/Engine10DevApplication
-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathChartRender.cs
98 lines (55 loc) · 2.14 KB
/
ChartRender.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using ESRI.ArcGIS.esriSystem;
using ESRI.ArcGIS.SystemUI;
using ESRI.ArcGIS.Geometry;
using ESRI.ArcGIS.Display;
using ESRI.ArcGIS.Geodatabase;
using ESRI.ArcGIS.Carto;
using ESRI.ArcGIS.Controls;
using ESRI.ArcGIS.GlobeCore;
using ESRI.ArcGIS.DataSourcesFile;
namespace EngineApplication
{
class ChartRender
{
public ChartRender(AxMapControl pMapcontrol, IFeatureLayer pFtLayer, string pFieldName)
{
IGeoFeatureLayer pGeoFeaturelayer = pFtLayer as IGeoFeatureLayer;
IChartRenderer pChart = new ChartRendererClass();
IDataStatistics pDataStat = new DataStatisticsClass();
IFeatureCursor pFtCursor = pFtLayer.FeatureClass.Search(null, false);
pDataStat.Cursor = pFtCursor as ICursor;
pDataStat.Field = pFieldName;
double pMax = pDataStat.Statistics.Maximum;
IRendererFields pRenderFields = pChart as IRendererFields;
pRenderFields.AddField(pFieldName,pFieldName);
IBarChartSymbol pBarChart = new BarChartSymbolClass();
pBarChart.Width = 5;
IMarkerSymbol pMarkerSymbol = pBarChart as IMarkerSymbol;
pMarkerSymbol.Size = 12;
IChartSymbol pChartSym = pBarChart as IChartSymbol;
pChartSym.MaxValue = pMax;
ISymbolArray pSymbolArr = pBarChart as ISymbolArray;
IFillSymbol pFillSy = new SimpleFillSymbolClass();
pFillSy.Color = GetRgb(220, 0, 0);
pSymbolArr.AddSymbol(pFillSy as ISymbol);
pGeoFeaturelayer.Renderer = pChart as IFeatureRenderer;
pMapcontrol.ActiveView.PartialRefresh(esriViewDrawPhase.esriViewGeography, null, null);
}
public IRgbColor GetRgb(int r, int g, int b)
{
IRgbColor pRGB;
pRGB = new RgbColorClass();
pRGB.Red = r;
pRGB.Green = g;
pRGB.Blue = b;
return pRGB;
}
}
}