Select to view content in your preferred language

How to create Custom Renderer in JS?

1970
5
05-17-2011 07:26 AM
YardenCochav
Deactivated User
Hi all,

I must create a custom Renderer that combines classBreakRenderer and UniqueValueRenderer to symbolize special GraphicLayer.
How do I accomplish it? what is the synatx to do it?

I am totally stuck because I need to represent graphics according to classbreak values and uniqueValue attributes.

Very appreciate for any help
Yarden
0 Kudos
5 Replies
KenDoman
Frequent Contributor
Hi all,

I must create a custom Renderer that combines classBreakRenderer and UniqueValueRenderer to symbolize special GraphicLayer.
How do I accomplish it? what is the synatx to do it?

I am totally stuck because I need to represent graphics according to classbreak values and uniqueValue attributes.

Very appreciate for any help
Yarden


I can't see anything in API about using more than one renderer for the same GraphicLayer. You could either allow the user to switch between renderers using setRenderer(), or add two GraphicLayers to the map, one with the classBreak and the other with the uniqueValue renderer.

--Ken
0 Kudos
YardenCochav
Deactivated User
Thanks for the reply.
I have already tried to do 2 graphic layers but it doesn't solve the problem because my scenario is as follow:
I need to to draw trail points that simulate a movements a person.
So I need arrows with 36 directions  - implementing by classBreakRenderer with Angles breaks.
I need also to give special colors for points/arrows that have specific attributes.
Therefore, I need one graphicLayer that can symbolize trail points with directional arrows and on the same time can symbolize the arrows with different colors.

The user can't select desired symbology.
0 Kudos
AjayGoel1
New Contributor
Were you able to achieve this?  I am trying to do the exact same thing i.e. have a map show different shapes based on unique values but also show different colors based on number of entities.

Thanks in advance!
0 Kudos
VivekPrasad
Deactivated User
Can you guys please let me know, if you could achieve this. I did not find any way to do this.
0 Kudos
VivekPrasad
Deactivated User
Can you guys please let me know, if you could achieve this. I did not find any way to do this.


I could implement custom renderer, by extending "esri.renderer.Renderer". And overriding "getSymbol(graphic)" function. We need to write code in "getSymbol" function to identify the symbol to be applied for the "graphic" passed as parameter. And we need to create object for this custom renderer and apply this on layer. This function would be internally called for each graphic and that graphic will be displayed with symbol returned by this function.
0 Kudos