DanielTrone

Print Widget and Renderers with Functions

Discussion created by DanielTrone on May 10, 2013
Latest reply on Jan 23, 2018 by davetinkle
I am using the print widget and have noticed an unusual issue.

When I use a function-formula in the renderer instead of a simple variable, the legend does not display normally, but instead displays only the symbols used for that area and the label 'Override' (see attachment).  Is this a bug? (Also see code snippet below).

Secondly, also when I am using a function formula in the renderer, and when I use a defaultSymbol instead of setting the first parameter of ClassBreaksRenderer to false, the print process will fail.

Thirdly, when I use a renderer with a simple variable, and no default symbol, it works, but my transparency is always opaque. (At least in the first situation, with the Override labels, the transparency is correct).

<CODE>
  if (themevar === 'PCT_OTH_R') {
   renderer = new esri.renderer.ClassBreaksRenderer(false, function (graphic) {
    return ((graphic.attributes.OTHER_NH / graphic.attributes.POP0711) * 100);
   });
   renderer.addBreak({
    minValue: 0,
    maxValue: 2,
    symbol: new esri.symbol.SimpleFillSymbol().setColor(new dojo.Color([239, 237, 245, 0.5])),
    label: "< 2%"
   });
   renderer.addBreak({
    minValue: 2,
    maxValue: 5,
    symbol: new esri.symbol.SimpleFillSymbol().setColor(new dojo.Color([188, 189, 220, 0.5])),
    label: "2% to 5%"
   });
   renderer.addBreak({
    minValue: 5,
    maxValue: Infinity,
    symbol: new esri.symbol.SimpleFillSymbol().setColor(new dojo.Color([117, 107, 177, 0.5])),
    label: "> 5%"
   });
   $('#titleleg').html('PCT Other');
  }
</CODE>

Here is a link to the working application to see the print behavior in action.

http://dola.colorado.gov/gis-cms/sites/default/files/html/acs0711_11.html

And here is the fiddle (sorry its so long, but still 1/5 size of original project).
http://jsfiddle.net/DanielTrone/e2yse/

Attachments

Outcomes