Select to view content in your preferred language

dynamic assign unique value renderer and count distinct record

2613
2
02-09-2012 10:48 AM
ForamParikh
Regular Contributor
Hello i have couple of questions.

1) Multiple unique value renderer assign runtime on graphical layer:- I have one graphical layer as gpoly and i assign unique value render as Renderer="{StaticResource polyrender}" but now i have toggle button between two fields means if user click on project status then i want to use unique value render as projstatusrendere and if user select type then i want uniquevaluerendere as typerendere.so how to assing renderer value in code means runtime?
i tried

  gpoly.Renderer = this.Resources["polyrender"] as ESRI.ArcGIS.Client.UniqueValueRenderer; but it is not working so do you know how i can set renderer value runtime?

2) Line symbol buffer:- i have points and line on the graphical layer and i set simplelinesymbol but the line is so tiny that user can not see it properly so do you is there any way to set buffer area around the line or something?so that user can see it properly?I know we can change width but it will not look good and i know we can set effect of graphical layer but i want something that even the line is tiny it should be easily viewable.

3) Distinct count :- I used joint query everything is working fine but i want to know the distinct (column name) number from the features means i have
cnt = totalfeature.Features.Count(gtt => gtt.Attributes["GIC4.DBO.PROJECT_LOCATION_POLY.LOCATION_ID"] != null && (int)gtt.Attributes["GIC4.DBO.PROJECT_LOCATION_POLY.LOCATION_ID"] ==
int.Parse(graphic.Attributes["GIC4.DBO.PROJECT_LOCATION_POLY.LOCATION_ID"].ToString()));

                                    if (cnt > 1)
                                    {
                                        cnt=totalfeature.Features.Distinct(
so in cnt it will return me the count of projects are available for the same location_id so i get count properly but now i want like if the count is one then i want to know the distinct project status means if location id is 1 and it has two projects p1 and p2.then in cnt i will get 2 but now i want to check if p1 and p2 both are having same project status or not?if p1's project status is onqueue and p2's status is also onquque then it should give me one but if p1's status is onqueue and p2's status is completed then it should give me 2 do you know how can i use distinct of projectstatus location wise?

Please help,

Thanks
0 Kudos
2 Replies
JenniferNery
Esri Regular Contributor
You can switch between two renderers using the following code:
   var l = MyMap.Layers["California"] as GraphicsLayer;
   var firstRenderer = LayoutRoot.Resources["MyRenderer"] as IRenderer;
   var secondRenderer = LayoutRoot.Resources["MyRenderer"] as IRenderer;
   l.Renderer = l.Renderer == firstRenderer ? secondRenderer : firstRenderer;

There's also an SDK sample that builds renderer at run-time: http://help.arcgis.com/en/webapi/silverlight/samples/start.htm#Thematic_Interactive

This may be similar concept for scaling your line symbols: http://forums.arcgis.com/threads/28787-Scaling-Text-Symbols

This seem related to getting Distinct values: http://forums.arcgis.com/threads/16305-Attribute-Query-Task-Question
0 Kudos
ForamParikh
Regular Contributor
Thanks
It saved my time!
0 Kudos