AnsweredAssumed Answered

Error when assigning ClassBreaksRenderer to BiUniqueValueRenderer

Question asked by Barbara_Schneider on Dec 17, 2015
Latest reply on Jan 4, 2016 by Barbara_Schneider

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[i] + " - " + classBreaks[i + 1]);

   markerSymbol.Size = markerSizes[i];

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

}

 

Any help is appreciated!

Outcomes