Select to view content in your preferred language

Error when assigning ClassBreaksRenderer to BiUniqueValueRenderer

2856
2
12-17-2015 02:33 AM
BarbaraSchneider1
Deactivated User

I am creating a BiUniqueValueRenderer:

IBivariateRenderer bivariateRenderer = new BiUniqueValueRendererClass();

// Assign renderers it to biunique value renderer     

bivariateRenderer.MainRenderer = (IFeatureRenderer)uniqueValueRend;

bivariateRenderer.VariationRenderer = (IFeatureRenderer)classBreaksRend;

When I'm assigning the classBreaksRend to the bivariateRenderer, there is following error message: "Value is outside expected range".

I have assigned both the uniqueValueRenderer and the ClassBreaksRenderer separately to the layer, and both work fine.

Here is the code for creating the ClassBreaksRenderer:

IClassBreaksRenderer classBreaksRend = new ClassBreaksRenderer();

// Define the table histogram

ITableHistogram tableHistogram = (ITableHistogram) new TableHistogram();

tableHistogram.Field = fieldName;

tableHistogram.Table = (ITable)featLayer;

IHistogram histogram = (IHistogram) tableHistogram;

object doubleArrayValues;

object longArrayFequencies;

histogram.GetHistogram(out doubleArrayValues, out longArrayFequencies);

// Set up classification method

IClassifyGEN classifyGen = new EqualInterval();

classifyGen.Classify(doubleArrayValues, longArrayFrequencies, ref numClasses);

double[] classBreaks = (double[]) classifyGen.ClassBreaks;

// Set renderer properties

classBreaksRend.Field = fieldName;

classBreaksRend.FieldCount = numClasses;

classBreaksRend.MinimumBreak = classBreaks[0];

// Interpolate marker sizes

List<double> markerSizes = InterpolateMarkerSizes(numClasses, markerSymbol.Size, maxSymbolSize);

// Step through breaks and assign breaks, labels, and symbols

for (int i = 0; i < numClasses; i++)

{

   classBreaksRend.set_Break(i, classBreaks[i+1]);

   classBreaksRend.set_Label(i, classBreaks + " - " + classBreaks[i + 1]);

   markerSymbol.Size = markerSizes;

   classBreaksRend.set_Symbol(i, (ISymbol)markerSymbol);

}

Any help is appreciated!

0 Kudos
2 Replies
YuanLiu
Deactivated User

Hi, first you might want to check if their symbol types match or not. Besides have you tried to manually set these two renders in ArcMap to see if it works? As mentioned here http://resources.arcgis.com/en/help/arcobjects-net/componenthelp/index.html#//0012000002m8000000

0 Kudos
BarbaraSchneider1
Deactivated User

Hi Yuan,

the symbol types match: I'm using Simple Marker Symbols for both the UniqueValueRenderer and the ClassBreaksRenderer.

I have manually set these two renderers in ArcMap and it works.

0 Kudos