How to do labelling with AGSUniqueValueRenderer?

2077
4
Jump to solution
03-09-2012 06:41 AM
c_f_ong
New Contributor III
Hello

I can set labelling in AGSSimpleRenderer as follows:

AGSCompositeSymbol *composite = [AGSCompositeSymbol compositeSymbol];
AGSTextSymbol *textSymbol = [AGSTextSymbol textSymbolWithTextTemplate:@"${pointID}" color:[UIColor redColor]];
[composite.symbols addObject:textSymbol];
AGSSimpleRenderer *renderer = [AGSSimpleRenderer simpleRendererWithSymbol:composite];

However, I've a problem to do likewise with AGSUniqueValueRenderer. Any clue on how to do it?

Thanks.

Rgds
Ong CF
0 Kudos
1 Solution

Accepted Solutions
NimeshJarecha
Esri Regular Contributor
Ong CF,

In the case of Simple Renderer, there is only one symbol so you created one composite symbol. In the case of Unique Value Renderer, it depends on how many unique values are there. Suppose there are 5 unique values then you will have to create 5 composite symbols (simple symbol + text symbol) for each.

Please refer Working with Symbols and Renderers doc.

Regards,
Nimesh

View solution in original post

0 Kudos
4 Replies
NimeshJarecha
Esri Regular Contributor
Ong CF,

In the case of Simple Renderer, there is only one symbol so you created one composite symbol. In the case of Unique Value Renderer, it depends on how many unique values are there. Suppose there are 5 unique values then you will have to create 5 composite symbols (simple symbol + text symbol) for each.

Please refer Working with Symbols and Renderers doc.

Regards,
Nimesh
0 Kudos
c_f_ong
New Contributor III
Hi Nimesh

Thanks for your reply & I've got it to work now as follows:

// Create AGSUniqueValue objects
AGSUniqueValue *stn = [[AGSUniqueValue alloc] initWithValue:@"STN" label:nil description:nil symbol:composite];

Another query: What is the 'label' in the above statement used for? Thought it's for 'labelling' the symbol as what I had wanted to do. Also, how is the 'description' being used?

Thanks.

Rgds
Ong CF
0 Kudos
NimeshJarecha
Esri Regular Contributor
Good to know that you got it working now. The 'label' is basically a name of the symbol and 'description' is the description of the symbol.

Regards,
Nimesh
0 Kudos
DeniseKing
Esri Regular Contributor
If a post provides the answer to your question, then we encourage you to mark the post as "the answer" by activating the green check mark  right of the post. You can also "vote" on posts that you find helpful by clicking the blue caret mark. More information about the ArcGIS Discussion Forums MVP Program found here.

Thank you,
Esri Support
0 Kudos