samirgambhir

legendLayer issue

Discussion created by samirgambhir on Feb 27, 2013
Hi,
I am trying to use PrintTask to print map from my web application. It works fine but I have some issues with the legend layer task. I am using ArcGIS Server 10.1 API with Javascript 3.2.

The API reference suggests that legendLayer.layerId includes the id of the operational layer in the legend. I wish to have the syblayer ids displayed in the legend but not the layer id. If I do not include layer id in my legendLayer task, the sublayer does not print as well.

Additionally, I would like to have some control over the heading of this legend as well as the class intervals. Right now it is showing the abbreviated name  and values to the sixth decimal point for the indicator. I would like to replace the heading with the descriptive name of the indicator which should change dynamically when a different indicator is selected. Likewise I would like to round off the class interval values to the second decimal point.

Here is the code, and the output map is attached:
var legendLayer = new esri.tasks.LegendLayer();
legendLayer.layerId = "stateFeatureLayer";
legendLayer.subLayerIds = [0, 1];
var layoutOptions = {
  titleText : "Test Map",
  scalebarUnit : "Miles",
  legendLayers : [legendLayer]
 };

Attachments

Outcomes