This is similar to a question in another recent post of mine – but since this is dealing with generating maps using a print service, I figure it warranted a separate post.
I have a map that’s showing a feature layer. The feature layer has been symbolized in the code using a class breaks renderer. I’ve also set up custom map templates and a custom print service, to have control over the details of how an exported map will look. There are two things that I’m having trouble figuring out:
1 - In the exported map, the name of the feature class (also the layer name in the service) shows up in the legend… I don’t want that there. Interestingly, it does not show up in the Legend Dijit. Just in an exported image.
2 - I’d like to know if there is a way to force the legend to display multiple columns, since I have a portrait layout and only 3 or 4 classes will fit in one column before the legend goes off the page. Is there a setting somewhere in the renderer that I can use? Do I set that up in the custom mxd? It is saved with no layers in it, so I'm not sure how any settings I make there would carry through to when it's used with the print service.
Side note - I found that if the legend items still won't fit in the area, it will only show the title. I spent a while trying to figure out why my legend was empty, until I figured out I just needed to make my legend area larger.
Do you know if the same behavior would exist in the legend if your layer was a dynamic mapservice and not a feature layer? This would just be a test as I'm sure you need it to be a feature layer.
In this case, I do want it on the bottom. The image being created is only 6 inches wide by 8 inches tall (portrait). I have another option set up as 8" wide x 6" tall (landscape) - for that one I just have the legend as one column on the right.
I created a box for my legend in the lower corner of my template, but I wasn't sure what size to give the legend. How can you tell when it's still blank? When I resize it, the word Legend just got bigger and bigger and it didn't seem right to stretch it until it filled the box I'd created for it. I assume doing that would proportionally effect all the other text, yet to be populated once I apply the template for printing.
Is this resolved by turning on fitting strategy? Then it wouldn't matter how big the word Legend was, because the fonts would all resize to fit?
I think so. At least in my case, I'd originally noted the same as you... With no layers in the mxd, the legend only showed as the title word 'Legend', and setting it to be wider and taller only seemed to make the word bigger. Once I checked that 'Fixed Frame' checkbox, I was able to set a width and height for my legend without the title getting larger.
I have someone else who's coding against the printTemplate I authored, so I can't check this myself. I was told that after I turned on the fitting strategy, the legend disappeared entirely off the page. I wonder if it has to do with where the anchor point is.
Do you have a large number of layers in the legend? I would suggest having only 1 or 2 layers in the legend as a test and see if it still disappears.
From my experience, I had individual layers with many symbol classes that would disappear from the legend because the symbology for the entire layer would not fit in the legend box.
I have a bug open with ESRI where the shrink contents to fit frame in ArcGIS Server does not behave the same way as it does in ArcMap. I can post the NIM if you are interested.