//分级专题图 private void button2_Click(object sender, EventArgs e) { int classCount = 6; ITableHistogram tableHistogram; IBasicHistogram basicHistogram; ITable table; IGeoFeatureLayer geoFeatureLayer; geoFeatureLayer = getGeoLayer("Continents"); ILayer layer = geoFeatureLayer as ILayer; table = layer as ITable; tableHistogram = new BasicTableHistogramClass(); //按照 数值字段分级 tableHistogram.Table = table; tableHistogram.Field = "sqmi"; basicHistogram = tableHistogram as IBasicHistogram; object values; object frequencys; //先统计每个值和各个值出现的次数 basicHistogram.GetHistogram(out values, out frequencys); //创建平均分级对象 IClassifyGEN classifyGEN = new QuantileClass(); //用统计结果进行分级 ,级别数目为classCount classifyGEN.Classify(values, frequencys, ref classCount); //获得分级结果,是个 双精度类型数组 double[] classes; classes = classifyGEN.ClassBreaks as double[]; IEnumColors enumColors = CreateAlgorithmicColorRamp(classes.Length).Colors; IColor color; IClassBreaksRenderer classBreaksRenderer = new ClassBreaksRendererClass(); classBreaksRenderer.Field = "sqmi"; classBreaksRenderer.BreakCount = classCount; classBreaksRenderer.SortClassesAscending = true; ISimpleFillSymbol simpleFillSymbol; for (int i = 0; i < classes.Length - 1; i++) { color = enumColors.Next(); simpleFillSymbol = new SimpleFillSymbolClass(); simpleFillSymbol.Color = color; simpleFillSymbol.Style = esriSimpleFillStyle.esriSFSSolid; classBreaksRenderer.set_Symbol(i, simpleFillSymbol as ISymbol); classBreaksRenderer.set_Break(i, classes[i]); } if (geoFeatureLayer != null) { geoFeatureLayer.Renderer = classBreaksRenderer as IFeatureRenderer; } this.axMapControl1.ActiveView.Refresh(); }
private void setColor(IGeoFeatureLayer IGFL) { int classCount = 10; ITableHistogram tableHistogram; IBasicHistogram basicHistogram; ITable table; IGeoFeatureLayer geoFeatureLayer; geoFeatureLayer = IGFL; ILayer layer = geoFeatureLayer as ILayer; table = layer as ITable; tableHistogram = new BasicTableHistogramClass(); tableHistogram.Table = table; tableHistogram.Field = "HighTemperature"; basicHistogram = tableHistogram as IBasicHistogram; object values; object frequencys; basicHistogram.GetHistogram(out values, out frequencys); IClassifyGEN classifyGEN = new QuantileClass(); classifyGEN.Classify(values, frequencys, ref classCount); double[] classes; classes = classifyGEN.ClassBreaks as double[]; IEnumColors enumColors = CreateAlgorithmicColorRamp(classes.Length).Colors; IColor color; IClassBreaksRenderer classBreaksRenderer = new ClassBreaksRendererClass(); classBreaksRenderer.Field = "HighTemperature"; classBreaksRenderer.BreakCount = classCount + 1; classBreaksRenderer.SortClassesAscending = true; ISimpleFillSymbol simpleFillSymbol; for (int i = 0; i < classes.Length; i++) { color = enumColors.Next(); simpleFillSymbol = new SimpleFillSymbolClass(); simpleFillSymbol.Color = color; simpleFillSymbol.Style = esriSimpleFillStyle.esriSFSSolid; classBreaksRenderer.set_Symbol(i, simpleFillSymbol as ISymbol); classBreaksRenderer.set_Break(i, classes[i]); } if (geoFeatureLayer != null) { geoFeatureLayer.Renderer = classBreaksRenderer as IFeatureRenderer; } axMapControl1.ActiveView.Refresh(); }
private void setColor(IGeoFeatureLayer IGFL) { int classCount = 10; ITableHistogram tableHistogram; IBasicHistogram basicHistogram; ITable table; IGeoFeatureLayer geoFeatureLayer; geoFeatureLayer = IGFL; ILayer layer = geoFeatureLayer as ILayer; table = layer as ITable; tableHistogram = new BasicTableHistogramClass(); tableHistogram.Table = table; tableHistogram.Field = "HighTemperature"; basicHistogram = tableHistogram as IBasicHistogram; object values; object frequencys; basicHistogram.GetHistogram(out values, out frequencys); IClassifyGEN classifyGEN = new QuantileClass(); classifyGEN.Classify(values, frequencys, ref classCount); double[] classes; classes = classifyGEN.ClassBreaks as double[]; IEnumColors enumColors = CreateAlgorithmicColorRamp(classes.Length).Colors; IColor color; IClassBreaksRenderer classBreaksRenderer = new ClassBreaksRendererClass(); classBreaksRenderer.Field = "HighTemperature"; classBreaksRenderer.BreakCount = classCount + 1; classBreaksRenderer.SortClassesAscending = true; ISimpleFillSymbol simpleFillSymbol; for (int i = 0; i < classes.Length; i++) { color = enumColors.Next(); simpleFillSymbol = new SimpleFillSymbolClass(); simpleFillSymbol.Color = color; simpleFillSymbol.Style = esriSimpleFillStyle.esriSFSSolid; classBreaksRenderer.set_Symbol(i, simpleFillSymbol as ISymbol); classBreaksRenderer.set_Break(i, classes[i]); } if (geoFeatureLayer != null) geoFeatureLayer.Renderer = classBreaksRenderer as IFeatureRenderer; axMapControl1.ActiveView.Refresh(); }
private static void MapUsingClassbreaksRenderer() { string layerName = CboLayers.GetSelectedLayer(); ILayer layer = GetLayerByName(layerName); IFeatureLayer2 fLayer = layer as IFeatureLayer2; string fieldName = CboFields.GetSelectedField(); // Get the number of classes string selectedClass = CboClasses.GetSelectedClass(); int numberOfClasses = Convert.ToInt32(selectedClass); ITableHistogram tableHistogram = new TableHistogramClass(); tableHistogram.Table = fLayer.FeatureClass as ITable; tableHistogram.Field = fieldName; IHistogram histo = tableHistogram as IHistogram; object datavalues, datafrequencies; histo.GetHistogram(out datavalues, out datafrequencies); IClassify classify = new QuantileClass(); classify.SetHistogramData(datavalues, datafrequencies); classify.Classify(ref numberOfClasses); if (numberOfClasses <= 1) { return; } double[] classBreaks = (double[])classify.ClassBreaks; IClassBreaksRenderer render = new ClassBreaksRenderer(); render.Field = fieldName; render.BreakCount = numberOfClasses; render.MinimumBreak = classBreaks[0]; // Get the colors ICmykColor[] colors = ColorbrewerExtension.GetCmykColors(); IFillSymbol fill = null; // Iterate through the colors for (int i = 0; i < numberOfClasses; i++) { fill = new SimpleFillSymbol(); fill.Color = colors[i]; fill.Outline.Width = 0.5; render.Symbol[i] = fill as ISymbol; render.Break[i] = classBreaks[i + 1]; render.Label[i] = string.Format("{0} to {1}", classBreaks[i] , classBreaks[i + 1]); } IGeoFeatureLayer gFLayer = layer as IGeoFeatureLayer; gFLayer.Renderer = render as IFeatureRenderer; IMxDocument mxDoc = ArcMap.Application.Document as IMxDocument; mxDoc.ActiveView.PartialRefresh(esriViewDrawPhase.esriViewGeography, gFLayer , mxDoc.ActiveView.Extent); mxDoc.UpdateContents(); }
//分级专题图 private void button2_Click(object sender, EventArgs e) { int classCount = 6; ITableHistogram tableHistogram; IBasicHistogram basicHistogram; ITable table; IGeoFeatureLayer geoFeatureLayer; geoFeatureLayer = getGeoLayer("东丰县行政区域"); ILayer layer = geoFeatureLayer as ILayer; table = layer as ITable; tableHistogram = new BasicTableHistogramClass(); //按照 数值字段分级 tableHistogram.Table = table; tableHistogram.Field = "NAME"; basicHistogram = tableHistogram as IBasicHistogram; object values; object frequencys; //先统计每个值和各个值出现的次数 basicHistogram.GetHistogram(out values, out frequencys); //创建平均分级对象 IClassifyGEN classifyGEN = new QuantileClass(); //用统计结果进行分级 ,级别数目为classCount classifyGEN.Classify(values, frequencys, ref classCount); //获得分级结果,是个 双精度类型数组 double[] classes; classes = classifyGEN.ClassBreaks as double[]; IEnumColors enumColors = CreateAlgorithmicColorRamp(classes.Length).Colors; IColor color; IClassBreaksRenderer classBreaksRenderer = new ClassBreaksRendererClass(); classBreaksRenderer.Field = "NAME"; classBreaksRenderer.BreakCount = classCount; classBreaksRenderer.SortClassesAscending = true; ISimpleFillSymbol simpleFillSymbol; for (int i = 0; i < classes.Length - 1; i++) { color = enumColors.Next(); simpleFillSymbol = new SimpleFillSymbolClass(); simpleFillSymbol.Color = color; simpleFillSymbol.Style = esriSimpleFillStyle.esriSFSSolid; classBreaksRenderer.set_Symbol(i, simpleFillSymbol as ISymbol); classBreaksRenderer.set_Break(i, classes[i]); } if (geoFeatureLayer != null) { geoFeatureLayer.Renderer = classBreaksRenderer as IFeatureRenderer; } this.axMapControl1.ActiveView.Refresh(); }
private void DrawCCMaps() { m_intClassNumber = Convert.ToInt32(nudGCNClasses.Value); IFeatureClass pFClass = pFLayer.FeatureClass; //Determine Class Breaks for variable int intValueFldIdx = pFClass.FindField(strVarFldName); ITable pTable = (ITable)pFClass; IClassifyGEN pClassifyGEN = null; switch (cboGCClassify.Text) { case "Equal Interval": pClassifyGEN = new EqualIntervalClass(); break; case "Geometrical Interval": pClassifyGEN = new GeometricalInterval(); break; case "Natural Breaks": pClassifyGEN = new NaturalBreaksClass(); break; case "Quantile": pClassifyGEN = new QuantileClass(); break; case "StandardDeviation": pClassifyGEN = new StandardDeviationClass(); break; default: pClassifyGEN = new NaturalBreaksClass(); break; } ITableHistogram pTableHistogram = new BasicTableHistogramClass(); pTableHistogram.Field = strVarFldName; pTableHistogram.Table = pTable; //IHistogram pHistogram = (IHistogram)pTableHistogram2; IBasicHistogram pHistogram = (IBasicHistogram)pTableHistogram; ////Not working in ArcGIS 10.5 022417 HK //ITableHistogram pTableHistogram = new TableHistogramClass(); //pTableHistogram.Field = strVarFldName; //pTableHistogram.Table = pTable; //IHistogram pHistogram = (IHistogram)pTableHistogram; object xVals, frqs; pHistogram.GetHistogram(out xVals, out frqs); pClassifyGEN.Classify(xVals, frqs, m_intClassNumber); double[] cb = (double[])pClassifyGEN.ClassBreaks; //Class Determinations for vertical and horizontal axis if (m_VerticalBreaks == null) { pClassifyGEN = new QuantileClass(); //Using Quatile pTableHistogram = new BasicTableHistogramClass(); pTableHistogram.Field = strVerConFldName; pTableHistogram.Table = pTable; pHistogram = (IBasicHistogram)pTableHistogram; pHistogram.GetHistogram(out xVals, out frqs); pClassifyGEN.Classify(xVals, frqs, intVerCnt); m_VerticalBreaks = (double[])pClassifyGEN.ClassBreaks; } if (m_HorizontalBreaks == null) { pClassifyGEN = new QuantileClass(); //Using Quatile pTableHistogram = new BasicTableHistogramClass(); pTableHistogram.Field = strHorConFldName; pTableHistogram.Table = pTable; pHistogram = (IBasicHistogram)pTableHistogram; pHistogram.GetHistogram(out xVals, out frqs); pClassifyGEN.Classify(xVals, frqs, intHorCnt); m_HorizontalBreaks = (double[])pClassifyGEN.ClassBreaks; } //Create Renderer IClassBreaksRenderer pRender = new ClassBreaksRenderer(); pRender.Field = strVarFldName; pRender.BreakCount = m_intClassNumber; pRender.MinimumBreak = cb[0]; string strColorRamp = cboColorRamp.Text; IEnumColors pEnumColors = MultiPartColorRamp(strColorRamp, "CIE Lab", m_intClassNumber); pEnumColors.Reset(); int[,] arrColors = new int[m_intClassNumber, 3]; for (int k = 0; k < m_intClassNumber; k++) { IColor pColor = pEnumColors.Next(); IRgbColor pRGBColor = new RgbColorClass(); pRGBColor.RGB = pColor.RGB; arrColors[k, 0] = pRGBColor.Red; arrColors[k, 1] = pRGBColor.Green; arrColors[k, 2] = pRGBColor.Blue; } pEnumColors.Reset(); IRgbColor pColorOutline = new RgbColor(); //Can Change the color in here! pColorOutline = m_pSnippet.getRGB(picOutlineColor.BackColor.R, picOutlineColor.BackColor.G, picOutlineColor.BackColor.B); double dblGCOutlineSize = Convert.ToDouble(nudOutlinewidth.Value); ICartographicLineSymbol pOutLines = new CartographicLineSymbol(); pOutLines.Width = dblGCOutlineSize; pOutLines.Color = (IColor)pColorOutline; //' use this interface to set dialog properties IClassBreaksUIProperties pUIProperties = (IClassBreaksUIProperties)pRender; pUIProperties.ColorRamp = "Custom"; ISimpleFillSymbol pSimpleFillSym; pEnumColors.Reset(); double dblAdding = Math.Pow(0.1, m_intRounding); for (int j = 0; j < m_intClassNumber; j++) { pRender.Break[j] = cb[j + 1]; if (j == 0) { pRender.Label[j] = Math.Round(cb[j], m_intRounding).ToString("N" + m_intRounding.ToString()) + " - " + Math.Round(cb[j + 1], 2).ToString("N" + m_intRounding.ToString()); } else { pRender.Label[j] = Math.Round(cb[j] + dblAdding, m_intRounding).ToString("N" + m_intRounding.ToString()) + " - " + Math.Round(cb[j + 1], 2).ToString("N" + m_intRounding.ToString()); } pUIProperties.LowBreak[j] = cb[j]; pSimpleFillSym = new SimpleFillSymbolClass(); IRgbColor pRGBColor = m_pSnippet.getRGB(arrColors[j, 0], arrColors[j, 1], arrColors[j, 2]); pSimpleFillSym.Color = (IColor)pRGBColor; pSimpleFillSym.Outline = pOutLines; pRender.Symbol[j] = (ISymbol)pSimpleFillSym; } //Background Layer ISimpleRenderer pSimpleRender = new SimpleRendererClass(); ISimpleFillSymbol pBGSymbol = new SimpleFillSymbolClass(); pBGSymbol.Color = (IColor)m_pSnippet.getRGB(picBGColor.BackColor.R, picBGColor.BackColor.G, picBGColor.BackColor.B); ICartographicLineSymbol pBGOutLines = new CartographicLineSymbol(); pBGOutLines.Width = 0; pBGOutLines.Color = m_pSnippet.getRGB(255, 255, 255); pBGSymbol.Outline = pBGOutLines; pSimpleRender.Symbol = (ISymbol)pBGSymbol; IFeatureLayer pflBG = new FeatureLayerClass(); pflBG.FeatureClass = pFClass; IGeoFeatureLayer pGeoBG = (IGeoFeatureLayer)pflBG; pGeoBG.Renderer = (IFeatureRenderer)pSimpleRender; pGeoBG.Selectable = false; //Feature Count for each map m_intsFeatureCnts = new int[intVerCnt * intHorCnt]; int l = 0; for (int i = 0; i < intVerCnt; i++) { for (int j = 0; j < intHorCnt; j++) { IFeatureLayer pflOutput = new FeatureLayerClass(); pflOutput.FeatureClass = pFClass; IGeoFeatureLayer pGeofeatureLayer = (IGeoFeatureLayer)pflOutput; pGeofeatureLayer.Renderer = (IFeatureRenderer)pRender; IFeatureLayerDefinition2 pFDefinition = (IFeatureLayerDefinition2)pGeofeatureLayer; string strWhereClause = null; if (i == 0 && j == 0) { strWhereClause = strVerConFldName + " >= " + m_VerticalBreaks[i].ToString() + " AND " + strVerConFldName + " <= " + m_VerticalBreaks[i + 1].ToString() + " AND " + strHorConFldName + " >= " + m_HorizontalBreaks[j].ToString() + " AND " + strHorConFldName + " <= " + m_HorizontalBreaks[j + 1].ToString(); } else if (i != 0 && j == 0) { strWhereClause = strVerConFldName + " > " + m_VerticalBreaks[i].ToString() + " AND " + strVerConFldName + " <= " + m_VerticalBreaks[i + 1].ToString() + " AND " + strHorConFldName + " >= " + m_HorizontalBreaks[j].ToString() + " AND " + strHorConFldName + " <= " + m_HorizontalBreaks[j + 1].ToString(); } else if (i == 0 && j != 0) { strWhereClause = strVerConFldName + " >= " + m_VerticalBreaks[i].ToString() + " AND " + strVerConFldName + " <= " + m_VerticalBreaks[i + 1].ToString() + " AND " + strHorConFldName + " > " + m_HorizontalBreaks[j].ToString() + " AND " + strHorConFldName + " <= " + m_HorizontalBreaks[j + 1].ToString(); } else { strWhereClause = strVerConFldName + " > " + m_VerticalBreaks[i].ToString() + " AND " + strVerConFldName + " <= " + m_VerticalBreaks[i + 1].ToString() + " AND " + strHorConFldName + " > " + m_HorizontalBreaks[j].ToString() + " AND " + strHorConFldName + " <= " + m_HorizontalBreaks[j + 1].ToString(); } pFDefinition.DefinitionExpression = strWhereClause; IQueryFilter pQfilter = new QueryFilterClass(); pQfilter.WhereClause = strWhereClause; m_intsFeatureCnts[l] = pGeofeatureLayer.FeatureClass.FeatureCount(pQfilter); m_axMapControls[l].ActiveView.FocusMap.ClearLayers(); m_axMapControls[l].ActiveView.FocusMap.AddLayer(pGeoBG); m_axMapControls[l].ActiveView.FocusMap.AddLayer(pGeofeatureLayer); m_axMapControls[l].ActiveView.Extent = m_axMapControls[l].ActiveView.FullExtent; m_axMapControls[l].ActiveView.Refresh(); l++; } } lblVariable.Text = "Selected Variable: " + strVarFldName; UpdateRange(lvSymbol, m_intClassNumber, cb, arrColors, m_intRounding); if (m_blnAddBoxes) { UpdateTextBoxes(); } else { AddTextBoxes(); } UpdateLabels(); UpdateHorVerLabels(); }
/// <summary> /// 分等级法渲染器(ClassBreakRenderer), 可以用分级的颜色和符号来绘制 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void 分等级法渲染ToolStripMenuItem_Click(object sender, EventArgs e) { //数据分成10个等级 int classCount = 10; //声明一个ITableHistogram变量 //该变量用于控制从表格中生成的直方图的样式 ITableHistogram pTableHistogram; //声明一个IBasicHistogram变量 //该变量用于控制从不同数据源中生成的直方图 IBasicHistogram pBasicHistogram; //实例化表格对象 ITable pTable; //获取生成分级专题图的目标图层 IGeoFeatureLayer pGeoFeatureLayer; //获取渲染图层 pGeoFeatureLayer = getGeoLayer("北部湾"); //将pGeoFeatureLayer强转成ILayer ILayer pLayer = pGeoFeatureLayer as ILayer; //将目标图层(要素类)的属性表强转成ITable pTable = pLayer as ITable; //实例化 //BasicTableHistogram采用表对象输入数据的结构(如自然断点、分位数)生成直方图。 pTableHistogram = new BasicTableHistogramClass(); //赋值pTableHistogram的Table属性字段 pTableHistogram.Table = pTable; //确定分级字段 pTableHistogram.Field = "年"; //pTableHistogram强制转换为IBasicHistogram pBasicHistogram = pTableHistogram as IBasicHistogram; //先统计每个值出现的次数, 输出结果赋予values, frequencys object values; object frequencys; //out参数可以在一个方法中返回多个不同类型的值 pBasicHistogram.GetHistogram(out values, out frequencys); //创建平均分级对象 IClassifyGEN pClassifyGEN = new QuantileClass(); //用统计结果(values——值, frequences——出现频率)进行分级, 级别数目为classCount pClassifyGEN.Classify(values, frequencys, ref classCount); double[] classes; classes = pClassifyGEN.ClassBreaks as double[]; //获得分级结果, 是个双精度类型数组 //注意:获得双精度数组记录条数出现不可修复性错误, 故使用以下代码修复该错误 double[] myclasses; myclasses = new double[classCount]; //当classes不为null时 if (classes != null) { //遍历classes, 从后往前移一位 for (int j = 0; j < classCount; j++) { myclasses[j] = classes[j + 1]; } } //定义一个颜色枚举变量, 通过函数获取颜色带 IEnumColors pEnumColors = CreateAlgorithmicColorRamp(myclasses.Length).Colors; IColor color; //声明并实例化分级渲染器对象类 //该变量提供成员控制渐变色、渐变符号专题图的制作 IClassBreaksRenderer classBreaksRenderer = new ClassBreaksRendererClass(); //确定分级渲染的属性字段 classBreaksRenderer.Field = "年"; //分级数量 classBreaksRenderer.BreakCount = classCount; //指示该专题图是否按升序显示 classBreaksRenderer.SortClassesAscending = true; //简单填充符号(ISimpleFillSymbol) //该变量提供对成员的访问, 控制简单的填充符号 ISimpleFillSymbol simpleFillSymbol; //通过一个循环, 给所有渲染的等级附上渲染颜色 for (int i = 0; i < myclasses.Length; i++) { color = pEnumColors.Next(); simpleFillSymbol = new SimpleFillSymbolClass(); simpleFillSymbol.Color = color; //设置填充的样式(Style)为实体填充 simpleFillSymbol.Style = esriSimpleFillStyle.esriSFSSolid; //指定分级渲染的符号(Symbol) classBreaksRenderer.set_Symbol(i, simpleFillSymbol as ISymbol); //按照分级进行渲染 classBreaksRenderer.set_Break(i, myclasses[i]); } if (pGeoFeatureLayer != null) { //调用Renderer属性, 具体说明如何通过图层要素渲染器绘制图层 pGeoFeatureLayer.Renderer = classBreaksRenderer as IFeatureRenderer; } axMapControl1.Refresh(); //刷新axMapControl1 axTOCControl1.Update(); //更新axTOCControl1 }
private void getBreaksValues(ClassifyMethodName ClassifyMethod,ILayer layer,string fieldName,double intervl,bool bfeuq) { ITableHistogram tableHistogram = new BasicTableHistogramClass(); tableHistogram.Table = ((IDisplayTable)layer).DisplayTable; tableHistogram.Field = fieldName; object valueArray = null, freq = null; IBasicHistogram basicHistogram = (IBasicHistogram)tableHistogram; basicHistogram.GetHistogram(out valueArray, out freq); IClassify classify = null; int breakNum = (int)intervl; //����� switch (ClassifyMethod) { case ClassifyMethodName.EqualInterval: { EqualIntervalClass eq = new EqualIntervalClass(); eq.Classify(valueArray, freq, ref breakNum); classify = (IClassify)eq; break; } case ClassifyMethodName.StandardDeviation: { StandardDeviationClass sd = new StandardDeviationClass(); IStatisticsResults stat = basicHistogram as IStatisticsResults; classify = sd as IClassify; classify.SetHistogramData(valueArray, freq); IDeviationInterval di = sd as IDeviationInterval; di.DeviationInterval = 1; di.Mean = stat.Mean; di.StandardDev = stat.StandardDeviation; classify.Classify(ref breakNum); break; } case ClassifyMethodName.Quantile: { Quantile qc = new QuantileClass(); qc.Classify(valueArray, freq, ref breakNum); classify = qc as IClassify; break; } case ClassifyMethodName.NaturalBreaks: { NaturalBreaksClass nb = new NaturalBreaksClass(); nb.Classify(valueArray, freq, ref breakNum); classify = nb as IClassify; break; } case ClassifyMethodName.DefinedInterval: { DefinedIntervalClass di = new DefinedIntervalClass(); di.IntervalRange = intervl; di.Classify(valueArray, freq, ref breakNum); classify = di as IClassify; break; } default: { EqualIntervalClass eq = new EqualIntervalClass(); eq.Classify(valueArray, freq, ref breakNum); classify = (IClassify)eq; break; } } object o = classify.ClassBreaks; System.Array breakArray = o as System.Array; IFrequencyStatistics freqstat = basicHistogram as IFrequencyStatistics; lscBreakValues.Items.Clear(); foreach (object oo in breakArray) { lscBreakValues.Items.Add(oo.ToString()); } }