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!
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
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.