Select to view content in your preferred language

Class Break Renderer missing classes in legend

4946
8
02-05-2015 11:35 PM
FC_Basson
MVP Regular Contributor

I'm using the Javascript API for a custom web app.  The class break renderer that I'm using for polygon feature symbology with unique class values is displaying correctly in the map and the legend widget is also showing the classes correctly.  However, when I send the map to my 10.2.2 print service, the legend in the output map drops some of the class breaks at times (not always).  The JSON sent to the print service looks correct as well.  Any ideas or similar issues?

 

Regards

Frederick

0 Kudos
8 Replies
FC_Basson
MVP Regular Contributor

I have found that the missing legend classes in the print export map are a result of the active dataset that does not contain any values in the specific class range and hence the "empty" class gets dropped from the legend.

I would still like to see the full range for the class breaks in the print export map legend, because sometimes the missing class breaks are for values in the middle of the data range.

0 Kudos
SteveCole
Honored Contributor

I don't want to hijack this thread but I'm seeing the same behavior not only in Class Breaks but also a unique values renderer. Essentially, if a feature is not found in the current map extent, it's not included in the legend that's created with the Print widget.

The first screenshot shows the MXD which is the origin of one of the published services. The second screenshot is a portion of the output PDF and you can see that the first two classes from the class breaks are missing (because there are no values within the map extent).

I like the option of legends limited by what's visible but at times like this, I want to show the full symbology, be it a class breaks or unique values renderer (the TipPoint & TipLine layers have A,B,C,D,E,F values in the service but only C & E features are present within the current map extent). What gives?

serviceMXD.jpgprint_export_outcome.jpg

0 Kudos
TracySchloss
Honored Contributor

Really?  I would never have expected a particular class break value to fall under  'if it's not currently on the map, it's not in the legend'.   That's messed up. 

We've been working on a project and all our printing test have been to the full extent, where all the classes have been visible.  Obviously we need to check what happens once the user zooms into a smaller area.

0 Kudos
SteveCole
Honored Contributor

I hope I'm doing something wrong but, yeah- if that's how it's designed to work, ugh.

0 Kudos
TracySchloss
Honored Contributor

We were able to replicate this in our code too.  When you mention you liked the option of changing the legend to respond to what is currently visible, is that autoUpdate or some other parameter?

I notice the default to this is true.  Does setting this to 'false' help?

0 Kudos
SteveCole
Honored Contributor

I had no idea there was a setting. I've been following the Publishing additional services for printing tutorial to add different print sizes to my application so I only looked at the printTemplate object for option settings but didn't see anything. I'm not sure how you would intercept the process to tweak the legend dijit.

Anyways, this selective legend + the actual look of what DOES get generated is pushing me towards just creating a legend in my print template and coverting it to graphics. One of my layers which has a transparency option won't match exactly but the rest of the legend will look exactly how I want.

Two steps forward, one step back, eh?

0 Kudos
TracySchloss
Honored Contributor

It was the initial poster, but as you mentioned, we've sort of hijacked this thread.

For our project, the GIS is part of comprehensive data query portal.   All the data is generated from an external database and joined on-the-fly based on the user selection.  This means the class breaks and the resultant legend will always change.  A static legend is not an option for me.  If only it was that easy!

TracySchloss
Honored Contributor

I found two parameters autoUpdate and respectCurrentMapScale.  If I understand the documentation correctly, respectCurrentMapScale deals with sublayers.  I would think that rendering a layer either with unique values or class breaks is defining sublayers of that layer.

From Legend API help:

When true the legend will update with every scale change and displays only the layers and sub layers that are visible in the current map scale. When false, the legend does not update on every scale change and all layers and sub layers will be displayed. The default value is true.

0 Kudos