ArcEngine 专题图制作(C#)
点密度图、分层设色图/等级图、单值图、柱状图、饼状图的实现代码 C#

private void 点密度图ToolStripMenuItem_Click(object sender, EventArgs e)
{
//获取当前图层 ,并把它设置成IGeoFeatureLayer的实例
IMap pMap = axMapControl1.Map;
ILayer pLayer = pMap.get_Layer(0) as IFeatureLayer;
IFeatureLayer pFeatureLayer = pLayer as IFeatureLayer;
IGeoFeatureLayer pGeoFeatureLayer = pLayer as IGeoFeatureLayer;

//获取图层上的feature
IFeatureClass pFeatureClass = pFeatureLayer.FeatureClass;
IFeatureCursor pFeatureCursor = pFeatureClass.Search(null, false);
IFeature pFeature = pFeatureCursor.NextFeature();

///

///
//定义点密度图渲染组件
IDotDensityRenderer DotDensityRenderer = new DotDensityRendererClass();

//定义点密度图渲染组件对象的渲染字段对象
IRendererFields flds = (IRendererFields)DotDensityRenderer;
flds.AddField("FID", "FID");
//flds.AddField("Shape", "Shape");

//定义点密度图渲染得符号对象
IDotDensityFillSymbol ddSym = new DotDensityFillSymbolClass();
IRgbColor BackColor = new RgbColorClass();
BackColor.Red = 234;
BackColor.Blue = 128;
BackColor.Green = 220;
IRgbColor SymbolColor = new RgbColorClass();
SymbolColor.Red = 234;
SymbolColor.Blue = 128;
SymbolColor.Green = 220;
点密度图渲染背景颜色
//ddSym.BackgroundColor = BackColor;
ddSym.DotSize =8;
ddSym.FixedPlacement = true;
//ddSym.Color = SymbolColor;
ILineSymbol pLineSymbol=new CartographicLineSymbolClass();
ddSym.Outline = pLineSymbol;

//定义符号数组
ISymbolArray symArray = (ISymbolArray)ddSym;
//添加点密度图渲染的点符号到符号数组中去
ISimpleMarkerSymbol pMarkerSymbol = new SimpleMarkerSymbolClass();
pMarkerSymbol.Style. = esriSimpleMarkerStyle.esriSMSCircle;
pMarkerSymbol.Size = 2;
pMarkerSymbol.Color = SymbolColor;;

symArray.AddSymbol(pMarkerSymbol as ISymbol );

//设置点密度图渲染的点符号
//DotDensityRenderer.DotDensitySymbol =symArray;
DotDensityRenderer.DotDensitySymbol = ddSym;
//确定一个点代表多少值
DotDensityRenderer .DotValue=0.2;
//点密度渲染采用的颜色模式
DotDensityRenderer.ColorScheme = "Custom";
//创建点密度图渲染图例
DotDensityRenderer.CreateLegend();
//设置符号大小是否固定
DotDensityRenderer.MaintainSize = true;
//将点密度图渲染对象与渲染图层挂钩
pGeoFeatureLayer.Renderer = (IFeatureRenderer)DotDensityRenderer;
//刷新地图和TOOCotrol
IActiveView pActiveView = axMapControl1.Map as IActiveView;
pActiveView.Refresh();
axTOCControl1.Update();

}
private void 分层设色ToolStripMenuItem_Click(object sender, EventArgs e)
{

//获取当前图层 ,并把它设置成IGeoFeatureLayer的实例
IMap pMap = axMapControl1.Map;
ILayer pLayer = pMap.get_Layer(0) as IFeatureLayer;
IFeatureLayer pFeatureLayer = pLayer as IFeatureLayer;
IGeoFeatureLayer pGeoFeatureLayer = pLayer as IGeoFeatureLayer;

//获取图层上的feature
IFeatureClass pFeatureClass = pFeatureLayer.FeatureClass;
IFeatureCursor pFeatureCursor = pFeatureClass.Search(null, false);
IFeature pFeature = pFeatureCursor.NextFeature();

//
IFeatureRenderer PR=pGeoFeatureLayer.Renderer;

//JoinData("县级区域", "DZGB", "sectioncode"); //join外部表
// int DC ;
int desiredClasses = 5;
string fieldName = "AREA";
int classesCount;
double[] classes;
string strOutput = "";
bool ok;
object dataFrequency;
object dataValues;
ITable pTable ;
//IClassify pClassify;
EqualIntervalClass pClassify;
//IBasicHistogram pTableHistogram = new BasicTableHistogramClass();
//IHistogram pTableHistogram = new BasicTableHistogramClass();
ITableHistogram pTableHistogram = new BasicTableHistogramClass() as ITableHistogram;
IBasicHistogram pHistogram;
IClassBreaksRenderer pClassBreaksRenderer;
IHsvColor pFromColor;
IHsvColor pToColor;
IAlgorithmicColorRamp pAlgorithmicColorRamp;
IEnumColors pEnumColors;
IColor pColor;
ISimpleFillSymbol pSimpleFillSymbol;

pLayer = (IFeatureLayer)axMapControl1.get_Layer(0);
pGeoFeatureLayer = (IGeoFeatureLayer)pLayer;
pTable = (ITable)pGeoFeatureLayer;
pHistogram = (IBasicHistogram)pTableHistogram;
// Get values and frequencies for the field
pTableHistogram.Field = fieldName;
pTableHistogram.Table = pTable;
pHistogram.GetHistogram(out dataValues, out dataFrequency);
// Put values and frequencies into an Equal Interval Classify Object
pClassify = new EqualIntervalClass();
//pClassify = new NaturalBreaksClass();
pClassify.SetHistogramData(dataValues, dataFrequency);
pClassify.Classify(dataValues, dataFrequency, ref desiredClasses);
//pClassify.Classify(ref desiredClasses);
classes = (double[])pClassify.ClassBreaks;
classesCount = classes.Length;

// Initialise a new Class Breaks renderer
// Supply the number of Class Breaks and the field to perform. the class breaks on
pClassBreaksRenderer = new ClassBreaksRendererClass();
pClassBreaksRenderer.Field = fieldName;
pClassBreaksRenderer.BreakCount = classesCount;
pClassBreaksRenderer.SortClassesAscending = true;
// Use algorithmic color ramp to generate an range of colors between YELLOW to RED
// Initial color: YELLOW
pFromColor = new HsvColorClass();
pFromColor.Hue = 60;
pFromColor.Saturation = 100;
pFromColor.Value = 96;
// Final color: RED
pToColor = new HsvColorClass();
pToColor.Hue = 0;
pToColor.Saturation = 100;
pToColor.Value = 96;
// Set up HSV Color ramp to span from YELLOW to RED
pAlgorithmicColorRamp = new AlgorithmicColorRampClass();
pAlgorithmicColorRamp.Algorithm = esriColorRampAlgorithm.esriHSVAlgorithm;
pAlgorithmicColorRamp.FromColor = pFromColor;
pAlgorithmicColorRamp.ToColor = pToColor;
pAlgorithmicColorRamp.Size = classesCount;
pAlgorithmicColorRamp.CreateRamp(out ok);

pEnumColors = pAlgorithmicColorRamp.Colors;
for (int index = 0; index < classesCount - 1; index++)
{
pColor = pEnumColors.Next();
pSimpleFillSymbol = new SimpleFillSymbolClass();
pSimpleFillSymbol.Color = pColor;
pSimpleFillSymbol.Style. = esriSimpleFillStyle.esriSFSSolid;
pClassBreaksRenderer.set_Symbol(index, (ISymbol)pSimpleFillSymbol);
pClassBreaksRenderer.set_Break(index, classes[index + 1]);
// Store each break value for user output
strOutput += "-" + classes[index + 1] + "\n";
}
pGeoFeatureLayer.Renderer = (IFeatureRenderer)pClassBreaksRenderer;
//this.axMapControl1.Refresh();
/
//

//get the custom property from which is supposed to be the layer to be saved
object customProperty = null;
//IMapControl3 mapControl = null;
customProperty = axMapControl1.CustomProperty;

//ask the user to set a name for the new layer file
SaveFileDialog saveFileDialog = new SaveFileDialog();
saveFileDialog.Filter = "Layer File|*.lyr|All Files|*.*";
saveFileDialog.Title = "生成专题图";
saveFileDialog.RestoreDirectory = true;
saveFileDialog.FileName = System.IO.Path.Combine(saveFileDialog.InitialDirectory, pGeoFeatureLayer.Name + ".lyr");

//get the layer name from the user
DialogResult dr = saveFileDialog.ShowDialog();
if (saveFileDialog.FileName != ""&& dr == DialogResult.OK)
{
if (System.IO.File.Exists(saveFileDialog.FileName))
{
//try to delete the existing file
System.IO.File.Delete(saveFileDialog.FileName);
}

//create a new LayerFile instance
ILayerFile layerFile = new LayerFileClass();
//create a new layer file
layerFile.New(saveFileDialog.FileName);
//attach the layer file with the actual layer
layerFile.ReplaceContents((ILayer)pGeoFeatureLayer);
//save the layer file
layerFile.Save();

//ask the user whether he'd like to add the layer to the map
if (DialogResult.Yes == MessageBox.Show("Would you like to add the layer to the map?", "Message", MessageBoxButtons.YesNo, MessageBoxIcon.Question))
{
axMapControl1.AddLayerFromFile(saveFileDialog.FileName, 0);
}
}

}

private void 单值图ToolStripMenuItem1_Click(object sender, EventArgs e)
{
//获取当前图层 ,并把它设置成IGeoFeatureLayer的实例
IMap pMap = axMapControl1.Map;
ILayer pLayer = pMap.get_Layer(0) as IFeatureLayer;
IFeatureLayer pFeatureLayer = pLayer as IFeatureLayer;
IGeoFeatureLayer pGeoFeatureLayer = pLayer as IGeoFeatureLayer;

//获取图层上的feature
IFeatureClass pFeatureClass = pFeatureLayer.FeatureClass;

IFeatureCursor pFeatureCursor = pFeatureClass.Search(null, false);

//定义单值图渲染组件
IUniqueValueRenderer pUniqueValueRenderer = new UniqueValueRendererClass();
//设置渲染字段对象
pUniqueValueRenderer.FieldCount = 1;
pUniqueValueRenderer.set_Field(0, "ID");
//创建填充符号
ISimpleFillSymbol PFillSymbol = new SimpleFillSymbolClass();
pUniqueValueRenderer.DefaultSymbol = (ISymbol)PFillSymbol;
pUniqueValueRenderer.UseDefaultSymbol = false;

//QI the table from the geoFeatureLayer and get the field number of
ITable pTable;
int fieldNumber;
pTable = pGeoFeatureLayer as ITable ;
fieldNumber = pTable.FindField("ID");
if (fieldNumber == -1)
{
MessageBox.Show("Can't find field called ", "Message", MessageBoxButtons.OK, MessageBoxIcon.Information);

}

//创建并设置随机色谱
IRandomColorRamp pColorRamp = new RandomColorRampClass();
pColorRamp.StartHue = 0;
pColorRamp.MinValue = 99;
pColorRamp.MinSaturation = 15;
pColorRamp.EndHue = 360;
pColorRamp.MaxValue = 100;
pColorRamp.MaxSaturation = 30;
pColorRamp.Size = 100;
//pColorRamp.Size = pUniqueValueRenderer.ValueCount;
bool k = true;
pColorRamp.CreateRamp(out ok);
IEnumColors pEnumRamp;
pEnumRamp = pColorRamp.Colors;

//为每个值设置一个符号
int n = pFeatureClass.FeatureCount(null);
for (int i = 0; i < n; i++)
{
IFeature pFeature = pFeatureCursor.NextFeature();
IClone pSourceClone = PFillSymbol as IClone;
ISimpleFillSymbol pSimpleFillSymbol = pSourceClone.Clone() as ISimpleFillSymbol ;
string pFeatureValue = pFeature.get_Value(pFeature.Fields.FindField("ID")).ToString();
pUniqueValueRenderer.AddValue(pFeatureValue, "烈度", (ISymbol)pSimpleFillSymbol);
}
//为每个符号设置颜色
for (int i = 0; i <= pUniqueValueRenderer.ValueCount - 1; i++)
{
string xv = pUniqueValueRenderer.get_Value(i);
if (xv != "")
{
ISimpleFillSymbol pNextSymbol = (ISimpleFillSymbol)pUniqueValueRenderer.get_Symbol(xv);
pNextSymbol.Color = pEnumRamp.Next();
pUniqueValueRenderer.set_Symbol(xv, (ISymbol)pNextSymbol);

}
}
//将单值图渲染对象与渲染图层挂钩
pGeoFeatureLayer.Renderer = (IFeatureRenderer)pUniqueValueRenderer;
pGeoFeatureLayer.DisplayField = "ID";
//刷新地图和TOOCotrol
IActiveView pActiveView = axMapControl1.Map as IActiveView;
pActiveView.Refresh();
axTOCControl1.Update();

}
private void 等级图ToolStripMenuItem_Click(object sender, EventArgs e)
{

//获取当前图层 ,并把它设置成IGeoFeatureLayer的实例
IMap pMap = axMapControl1.Map;
ILayer pLayer = pMap.get_Layer(0) as IFeatureLayer;
IFeatureLayer pFeatureLayer = pLayer as IFeatureLayer;
IGeoFeatureLayer pGeoFeatureLayer = pLayer as IGeoFeatureLayer;

//获取图层上的feature
IFeatureClass pFeatureClass = pFeatureLayer.FeatureClass;
IFeatureCursor pFeatureCursor = pFeatureClass.Search(null, false);
IFeature pFeature = pFeatureCursor.NextFeature();
//

//定义所需的接口对象和相关变量

IClassBreaksUIProperties pUIProperties;
object dataValues;
object dataFrequency;
//double[] cb;

int breakIndex;
long ClassesCount;
int numClass;
numClass = 10;
double[] Classes;
//

ITable pTable;
pTable = pFeatureClass as ITable;
IBasicHistogram pBasicHist = new BasicTableHistogramClass();
ITableHistogram pTableHist;

pTableHist = (ITableHistogram)pBasicHist;

//Get values and frequencies for the population field into a table histogram object
pTableHist.Field = "AREA";
pTableHist.Table = pTable;
pBasicHist.GetHistogram(out dataValues, out dataFrequency);

IClassifyGEN pClassifyGEN = new QuantileClass();
pClassifyGEN.Classify(dataValues, dataFrequency, ref numClass);
Classes = (double[])pClassifyGEN.ClassBreaks;
ClassesCount = long.Parse(Classes.GetUpperBound(0).ToString());

//Initialise a new class breaks renderer and supply the number of class breaks and the field to perform. the class breaks on.
IClassBreaksRenderer pClassBreaksRenderer = new ClassBreaksRendererClass();
pClassBreaksRenderer.Field = "AREA";
//pClassBreaksRenderer.BreakCount = ClassesCount;
pClassBreaksRenderer.MinimumBreak = Classes[0];
pClassBreaksRenderer.SortClassesAscending = true;
//设置着色对象的分级数目
pClassBreaksRenderer.BreakCount = int.Parse(ClassesCount.ToString());

//创建并设置随机色谱
IAlgorithmicColorRamp pColorRamp = new AlgorithmicColorRampClass();
pColorRamp.Algorithm = esriColorRampAlgorithm.esriCIELabAlgorithm;
IEnumColors pEnumColors;
IRgbColor pColor1 = new RgbColorClass();
IRgbColor pColor2 = new RgbColorClass();
pColor1.Red = 255;
pColor1.Green = 210;
pColor1.Blue = 210;
pColor2.Red = 190;
pColor2.Green = 0;
pColor2.Blue = 170;
pColorRamp.FromColor = pColor1;
pColorRamp.ToColor = pColor2;
pColorRamp.Size = numClass;
bool k = true;
pColorRamp.CreateRamp(out ok);
pEnumColors = pColorRamp.Colors;
pEnumColors.Reset();// use this interface to set dialog properties

pUIProperties = pClassBreaksRenderer as IClassBreaksUIProperties;
pUIProperties.ColorRamp = "Custom";

ISimpleFillSymbol pSimpleMarkerSymbol = new SimpleFillSymbolClass();

IColor pColor;
int[] colors = new int[numClass];

// be careful, indices are different for the diff lists
for (breakIndex = 0; breakIndex < ClassesCount; breakIndex++)
{

pClassBreaksRenderer.set_Label (breakIndex,Classes[breakIndex] + " - " + Classes[breakIndex + 1]);
pUIProperties.set_LowBreak (breakIndex ,Classes[breakIndex]);
pSimpleMarkerSymbol = new SimpleFillSymbolClass();
pColor = pEnumColors.Next();
pSimpleMarkerSymbol.Color = pColor;
colors[breakIndex] = pColor.RGB;

pClassBreaksRenderer.set_Symbol(breakIndex, (ISymbol)pSimpleMarkerSymbol);
pClassBreaksRenderer.set_Break(breakIndex, Classes[breakIndex + 1]);
}

//将等级图渲染对象与渲染图层挂钩
pGeoFeatureLayer.Renderer = (IFeatureRenderer)pClassBreaksRenderer;
//刷新地图和TOOCotrol
IActiveView pActiveView = axMapControl1.Map as IActiveView;
pActiveView.Refresh();
axTOCControl1.Update();
}

private void 柱状图ToolStripMenuItem_Click(object sender, EventArgs e)
{

//获取当前图层 ,并把它设置成IGeoFeatureLayer的实例
IMap pMap = axMapControl1.Map;
ILayer pLayer = pMap.get_Layer(0) as IFeatureLayer;
IFeatureLayer pFeatureLayer = pLayer as IFeatureLayer;
IGeoFeatureLayer pGeoFeatureLayer = pLayer as IGeoFeatureLayer;

//获取图层上的feature
IFeatureClass pFeatureClass = pFeatureLayer.FeatureClass;

//定义柱状图渲染组建对象
IChartRenderer pChartRenderer = new ChartRendererClass();
//定义渲染字段对象并给字段对象实例化为pChartRenderer
IRendererFields pRendererFields;
pRendererFields = (IRendererFields)pChartRenderer;
//向渲染字段对象中添加字段--- 待补充自定义添加
pRendererFields.AddField("AREA", "AREA");
pRendererFields.AddField("ID", "ID");

// 通过查找features的所用字段的值,计算出数据字段的最大值,作为设置柱状图的比例大小的依据
ITable pTable;
int fieldNumber;
pTable = pGeoFeatureLayer as ITable;
// 查找出geoFeatureLayer的属性表中的字段个数
fieldNumber = pTable.FindField("AREA");
if (fieldNumber == -1)
{
MessageBox.Show("Can't find field called ", "Message", MessageBoxButtons.OK, MessageBoxIcon.Information);

}

const int numFields = 2;// 设置bars的个数
int[] fieldIndecies = new int[2];
//long fieldIndex;
double maxValue;
bool firstValue;
//double[] fieldValue=new double[5];
double fieldValue;
fieldIndecies[0] = pTable.FindField("AREA");
fieldIndecies[1] = pTable.FindField("ID");
firstValue = true;
maxValue = 0;
int n = pFeatureClass.FeatureCount(null);
for (int i = 0; i < numFields; i++)
{
IFeatureCursor pFeatureCursor = pFeatureClass.Search(null, false);
for (int j = 0; j < n; j++)
{
IFeature pFeature = pFeatureCursor.NextFeature();
fieldValue = Convert.ToDouble(pFeature.get_Value(fieldIndecies[i]));

if (firstValue)
{
//给maxValue赋初值
maxValue = fieldValue;
firstValue = false;
}
else if (fieldValue > maxValue)
{
maxValue = fieldValue;
}

}
}

if (maxValue <= 0)
{
MessageBox.Show("Failed to calculate the maximum value or maxvalue is 0.", "Message", MessageBoxButtons.OK, MessageBoxIcon.Information);
}

// 定义并设置渲染时用的chart marker symbol
IBarChartSymbol pBarChartSymbol = new BarChartSymbolClass();
pBarChartSymbol.Width = 6;

IChartSymbol pChartSymbol;
pChartSymbol = pBarChartSymbol as IChartSymbol;

IMarkerSymbol pMarkerSymbol;
pMarkerSymbol = (IMarkerSymbol)pBarChartSymbol;

IFillSymbol pFillSymbol ;
//设置pChartSymbol的最大值
pChartSymbol.MaxValue = maxValue;
// 设置bars的最大高度
pMarkerSymbol.Size = 16;
//下面给每一个bar设置符号

//定义符号数组
ISymbolArray pSymbolArray = (ISymbolArray)pBarChartSymbol;

//克隆pFillSymbol用于符号操作
//IClone pSourceClone = pFillSymbol as IClone;
//ISimpleFillSymbol pSimpleFillSymbol = pSourceClone.Clone() as ISimpleFillSymbol;

// 向符号数组中添加设置后的符号
//pSimpleFillSymbol.Color = GetRGBColor(193, 252, 179);
//pSymbolArray.AddSymbol(pSimpleFillSymbol as ISymbol);

//pSimpleFillSymbol.Color = GetRGBColor(145, 55, 200);
//pSymbolArray.AddSymbol(pSimpleFillSymbol as ISymbol);

//添加第一个符号
pFillSymbol = new SimpleFillSymbolClass();
pFillSymbol.Color = GetRGBColor(193, 252, 179) as IColor ;
pSymbolArray.AddSymbol(pFillSymbol as ISymbol) ;
//添加第二个符号
pFillSymbol = new SimpleFillSymbolClass();
pFillSymbol.Color = GetRGBColor(145, 55, 251)as IColor;
pSymbolArray.AddSymbol(pFillSymbol as ISymbol);

// 设置背景符号
//pSimpleFillSymbol.Color = GetRGBColor(239, 150, 190);
//pChartRenderer.BaseSymbol = pSimpleFillSymbol as ISymbol;

// Disable overpoaster 让符号处于图形中央
pChartRenderer.UseOverposter = false;

//pChartRenderer.ChartSymbol = pSymbolArray as IChartSymbol;
pChartRenderer.ChartSymbol = pChartSymbol as IChartSymbol;
//pChartRenderer.Label = "AREA";
pChartRenderer.CreateLegend();

//将柱状图渲染对象与渲染图层挂钩
pGeoFeatureLayer.Renderer = (IFeatureRenderer)pChartRenderer;
pGeoFeatureLayer.DisplayField = "ID";
//刷新地图和TOOCotrol
IActiveView pActiveView = axMapControl1.Map as IActiveView;
pActiveView.Refresh();
axTOCControl1.Update();

}
private void asdToolStripMenuItem_Click(object sender, EventArgs e)
{

//获取当前图层 ,并把它设置成IGeoFeatureLayer的实例
IMap pMap = axMapControl1.Map;
ILayer pLayer = pMap.get_Layer(0) as IFeatureLayer;
IFeatureLayer pFeatureLayer = pLayer as IFeatureLayer;
IGeoFeatureLayer pGeoFeatureLayer = pLayer as IGeoFeatureLayer;

//获取图层上的feature
IFeatureClass pFeatureClass = pFeatureLayer.FeatureClass;
IFeatureCursor pFeatureCursor = pFeatureClass.Search(null, false);
IFeature pFeature = pFeatureCursor.NextFeature();
//

/
IBasicHistogram pHistogram;
ITableHistogram pTableHistogram = new BasicTableHistogramClass();
ITable pTable;
IClassifyGEN pClassifyGEN = new EqualIntervalClass();
long ClassesCount;
IClassBreaksRenderer pClassBreaksRenderer = new ClassBreaksRendererClass();
IAlgorithmicColorRamp pAlgorithmicColorRamp = new AlgorithmicColorRampClass();
ISimpleMarkerSymbol pSimpleMarkerSymbol = new SimpleMarkerSymbolClass();
IEnumColors pEnumColors;
object dataFrequency;
object dataValue;
double[] Classes;
int numClass;
numClass = 10;

pTable = (ITable)pGeoFeatureLayer;

//根据渲染字段得到渲染信息赋值给两个数组。
pHistogram = (IBasicHistogram)pTableHistogram;
pTableHistogram.Field = "AREA";
pTableHistogram.Table = pTable;
pHistogram.GetHistogram(out dataValue, out dataFrequency);

//下面是分级方法,用于根据获得的值计算得出符合条件要求的数据

//根据条件计算出Classes和ClassesCount.

pClassifyGEN.Classify(dataValue, dataFrequency, ref numClass);
//返回一个数组,注意这个数组的下标是从1开始的
Classes = (double[])pClassifyGEN.ClassBreaks;

ClassesCount = long.Parse(Classes.GetUpperBound(0).ToString());

pClassBreaksRenderer.Field = "AREA";

//创建并设置随机色谱
IAlgorithmicColorRamp pColorRamp = new AlgorithmicColorRampClass();
pColorRamp.Algorithm = esriColorRampAlgorithm.esriCIELabAlgorithm;

IRgbColor pColor1 = new RgbColorClass();
IRgbColor pColor2 = new RgbColorClass();
pColor1.Red = 255;
pColor1.Green = 210;
pColor1.Blue = 210;
pColor2.Red = 190;
pColor2.Green = 0;
pColor2.Blue = 170;
pColorRamp.FromColor = pColor1;
pColorRamp.ToColor = pColor2;
pColorRamp.Size = 20;
bool k = true;
pColorRamp.CreateRamp(out ok);
pEnumColors = pColorRamp.Colors;
pEnumColors.Reset();// use this interface to set dialog properties

//设置着色对象的分级数目
pClassBreaksRenderer.BreakCount = int.Parse(ClassesCount.ToString());
pClassBreaksRenderer.SortClassesAscending = true;
//设置颜色条带:

pAlgorithmicColorRamp.FromColor = pColor1;
pAlgorithmicColorRamp.ToColor = pColor2;
pAlgorithmicColorRamp.Size = numClass;
bool re = false;
pAlgorithmicColorRamp.CreateRamp(out re);
pEnumColors = pAlgorithmicColorRamp.Colors;
pEnumColors.Reset();
//定义图形边界符号
ILineSymbol pLineSymbol;

IColor pColor;
int[] colors = new int[numClass];
int breakIndex = 0;

for (breakIndex = 0; breakIndex < ClassesCount; breakIndex++)
{
//pEnumColors.Reset();
pColor = pEnumColors.Next();
pSimpleMarkerSymbol.Color = pColor;
colors[breakIndex] = pColor.RGB;
pSimpleMarkerSymbol.Style. = esriSimpleMarkerStyle.esriSMSSquare;//.esriSMSCircle;
pSimpleMarkerSymbol.Size = 10;
pClassBreaksRenderer.set_Symbol(breakIndex, (ISymbol)pSimpleMarkerSymbol);
pClassBreaksRenderer.set_Break(breakIndex, Classes[breakIndex + 1]);
pLineSymbol = new CartographicLineSymbolClass();
//pSimpleMarkerSymbol.Outline= true ;
// pEnumColors.Reset();
//pSimpleMarkerSymbol.OutlineColor = pEnumColors.Next(); ;
& nbs

专题图制作(点密度图、分层设色图/等级图、单值图、柱状图、饼状图)相关推荐

  1. java excel 饼图,java 导入导出excle 和 生成柱状图饼状图的demo/excle数据如何转成饼状图...

    在EXCEL中,如何把表格中的数据转换成饼状图? 在Excel中,把中的数据转换状图的操作步骤如下: 想转换的数据源,插入饼状图,Excel会自动根据选择的数据源生成饼状图.接下来,可以自定义饼状图的 ...

  2. 安卓饼状图设置软件_安卓(Android)开发之自定义饼状图

    先来看看效果图 先分析饼状图的构成,非常明显,饼状图就是一个又一个的扇形构成的,每个扇形都有不同的颜色,对应的有名字,数据和百分比. 经以上信息可以得出饼状图的最基本数据应包括:名字 数据值 百分比 ...

  3. Word中插入表格与柱状图饼状图技术经验分享

    最近公司一个项目里要求自动生成报告功能,研究了1周多,主要实现方式是通过调用微软Office COM组件来实现操作word文档,生成段落,表格,及各种图表. 本人发现操作word地方也有几个坑人的地方 ...

  4. 用python把数据画成饼状图_Python学习第92课——数据可视化之饼状图绘制

    [每天几分钟,从零入门python编程的世界!] 假如一个行业只有ABCD四个公司,我们想要用图表展现,它们各自每年的生产总额,占整个行业的比例是多少,这时我们用饼状图(pie chart)更好. 假 ...

  5. Superset 制作 地图 柱状图 饼状图

    文章目录 制作地图 制作柱状图 制作饼状图 制作地图 1)创建 Chart 2)配置 Chart 3)结果图 制作柱状图 1)创建 Chart 2)配置 Chart 3)结果图 制作饼状图 1)创建 ...

  6. java实现将数据生成图表至excel导出(包括折线图,柱状图,饼状图)

    1. 目的 根据已有数据,手动(java后台)生成图表至excel并导出.用于后台查询到数据后直接创建图表,可以代替直接使用图表信息字符串. 2. 说明 使用jfree图表绘制类库绘制图表,并生成到本 ...

  7. poi导出excel文件,并生成原生图表(包括折线图,柱状图,饼状图,面积图)

    前段时间,因为客户需要,要做一个导出excel文件功能,并能生成原生的图表的(不是把图片插入到excel文档),找了很多文档看,也看了很多别人的代码,个人也总结了一下,不足之处,请各位大牛谅解. 需要 ...

  8. android饼状图简书,自定义 view 练手 - 简单的饼状图

    今天咱们来一个例子练练手,饼状图这样的图表算是最好的了,复杂的话可以很复杂, 采用 surfaceview + 动画 可以使用很优秀的观感体验:简单的话可以很简单,仅仅画出图来就行,不用考虑动画啥的 ...

  9. mysql 统计做饼状图_使用Highcharts结合PHP与Mysql生成饼状图

    我们在做复杂的数据统计功能时会用到饼状图,饼状图用整个圆表示总体的数量或整体值1,用圆内各个扇形的大小表示各部分数量或该部分占总体的百分比,它可以清晰直观的表示各部分之间以及各部分与整体之间的数量关系 ...

  10. Echarst柱状图+饼状图+vue2 商品案例

    最终效果展示: echarst非常简单,就是使用的数据需要按照规定的格式,往往是获取数据较难 首先前端,只需要一个div,用ref指定名称,定好宽高,就ok,div多大,图就会自适应多大 <di ...

最新文章

  1. 非升即走的博士们日后该怎么办?院长给出这5点建议
  2. 数据结构之直接插入排序
  3. MTK 软件设置路径
  4. Flash播放控件属性详解
  5. Java8时间转换(LocalDateTime)代码实例
  6. checkbox属性checked=checked已有,但却不显示打勾的解决办法
  7. Ubuntu 12.04 安装PYQT4和Eric4
  8. Redis安装及Java客户端的使用浅析(jedis)
  9. 另存为映射技术,异速联让导出导入更简单
  10. 获取时间戳及转化为yyyyMMdd格式的时间
  11. GPT-3的最强落地方式?陈丹琦提出小样本微调方法,比普通微调提升11%
  12. java存根_Java方法存根
  13. 1138 清除行注释
  14. 今天的我又来到阳台上的玩耍
  15. ​英伟达 CEO 黄仁勋:摩尔定律结束了;苹果新专利:折叠式iPhone可自行修复折痕;Rust 1.64.0 发布|极客头条...
  16. android TextView 添加下划线
  17. 全志T507核心板常见问题解析
  18. 二叉搜索树的最近公共祖先、二叉树的最近公共祖先
  19. 面向对象原则:高内聚、低耦合。多聚合、少继承
  20. 史上最全SQL基础知识总结

热门文章

  1. 交换机带宽占用监视_您说什么:您是否监视带宽使用情况?
  2. 解决missing 2 required positional arguments问题
  3. 程序猿初体验之“大一女生“【心路之旅】
  4. Mac版Cornerstone破解方法
  5. spring.profiles.active 多种开发环境配置详解
  6. C# winform 实习语音播报
  7. SpringMVC常见组件之View分析
  8. cocos lua -- 文字拼接及颜色处理(富文本)
  9. android mp4 to gif,android – 如何将GIF转换为Mp4是否可能?
  10. 阿里平头哥 数字IC验证 校招一面面经