Select to view content in your preferred language

Can legends be printed using AGOL javascript templates 'print' task?

749
4
05-09-2013 08:23 AM
MatthewBaker2
Deactivated User
All,

We've got an application up and running where users are able to trace grass areas around schools in the district and rank them according to the priority of irrigation (low, medium, high) in order to prioritize which areas should be watered, etc. This is part of  mandated water conservation measures being implemented by the City of Denver.

The application is working great but we'd like to have a legend in the printed PDF generated by the default print task. The maps will be put in the hands of those doing the irrigation...legends would be quite handy for this application.

Is this possible, or should we consider moving the application in-house (rather than hosted on our AGOL organization account)?

Thanks!

-mb
Tags (2)
0 Kudos
4 Replies
KellyHutchins
Esri Notable Contributor
Hi Matthew,

The templates are not currently setup to handle printing legends. However you could download the template code and modify the code to include a legend.  For example, in the Basic Viewer template there's some code that defines the layout template in layout.js at approximately line 818. Currently this line sets the legend layers to an empty array which means that no legend will be printed.

    
   var layoutOptions = {
        'authorText': configOptions.owner,
        'titleText': configOptions.title,
        'scalebarUnit': (configOptions.i18n.viewer.main.scaleBarUnits === 'english') ? 'Miles' : 'Kilometers',
        'legendLayers': []
    };


To include the legend you'll want to replace this with an array that defines the legend layers. I've attached an updated layout.js file that shows how this would work.
0 Kudos
MatthewBaker2
Deactivated User
Thank you, Kelly! I'll give this a try and let you know what i come up with!

-mb
0 Kudos
DianaUmpierre
Deactivated User
I have similar question. I know it's possible to make changes by downloading the code, but my main Q is:

"Is this possible (to make the changes and keep in AGOL), or should we consider moving the application in-house (rather than hosted on our AGOL organization account)?"
0 Kudos
MikeMinami
Esri Notable Contributor
The template support limited configuration. If you want to do something you don't see in the settings to configure the template, then it's not available. The only option is to download the code, modify it, and host it on your own web server.

Thanks,

Mike
0 Kudos