var info = { value: [1778,1779], symbol: new esri.symbol.SimpleFillSymbol().setColor(new dojo.Color([256,0,0])) }; var renderer = new esri.renderer.UniqueValueRenderer(defaultSymbol, "O"); renderer.infos = [info];
Hi,
Using an array instead a single string would be perfect for many solutions.
Please consider an implementation.
Best,
Martin
You can accomplish this functionality using multiple calls to your renderer's addValue method in combination with passing a function into the UniqueValueRenderer constructor. Check out this example:
r.addValue(3, greenSymbol);
renderer = new UniqueValueRenderer(defaultSymbol, function (value) { var expectedRedValue = 'red'; //You provide these based on your data var expectedYellowValue = 'yellow'; var expectedGreenValue = 'green'; if (value.attributes.YourAttribute == expectedRedValue) { return 1; } else if (value.attributes.YourAttribute == expectedYellowValue) { return 2; } else if (value.attributes.YourAttribute == expectedGreenValue) { return 3; } }); renderer.addValue(1, redSymbol); renderer.addValue(2, yellowSymbol); renderer.addValue(3, greenSymbol);
Hi,
Thanks for this solution.
We would like to use the UniqueValueRenderer inside the dynamicLayers parameter with a direkt browser request. The Request gets very long when the whole uniqueValueInfos part must be repeated for every single value.
Best,
Martin