SimpleFillSymbol alpha value producing different color across multiple polygons

853
8
Jump to solution
01-12-2017 10:38 AM
AndrewRousseau
New Contributor II

All of the polygons below are produced with the same color settings with 125 as the alpha value,

but you can see the result is different in each polygon.

Any way to get a consistent color with the same opacity in each?  I did double check and I'm pretty sure none of the polygons overlap.

0 Kudos
1 Solution

Accepted Solutions
AndrewRousseau
New Contributor II

I figured it out.  I was looping through the array of shapes from my database and conditionally only showing some of them based on filters on the page.  However, I neglected to include the "map.graphics.add(new Graphic(poly, sym));" call inside the condition so it was adding empty Graphic entries which for some reason was causing the color inconsistencies.  Thanks to @Kristian Ekenes as I discovered this in trying to create a sample of the code to post for debugging.  Thanks to everyone for your input, hopefully this post will help someone else debug this issue in the future if they make the same mistake!

View solution in original post

0 Kudos
8 Replies
RobertScheitlin__GISP
MVP Emeritus

Andrew,

   Are any of the polygons duplicated in the json?

0 Kudos
AndrewRousseau
New Contributor II

No duplicates, just double checked.

0 Kudos
KristianEkenes
Esri Regular Contributor

Which API version are you using? 

0 Kudos
AndrewRousseau
New Contributor II
0 Kudos
KristianEkenes
Esri Regular Contributor

I'm not able to independently verify this in a simple test app. I would need to see a sample with more of your code in context. Are you able to share this in jsbin or some other way?

0 Kudos
TomSellsted
MVP Regular Contributor

Andrew,

The range for alpha should be a value from 0 to 1.  Maybe that is creating your inconsistency?

Regards,

Tom

0 Kudos
KristianEkenes
Esri Regular Contributor

When loading a symbol from JSON the range is 0-255. 

See ArcGIS REST API.

AndrewRousseau
New Contributor II

I figured it out.  I was looping through the array of shapes from my database and conditionally only showing some of them based on filters on the page.  However, I neglected to include the "map.graphics.add(new Graphic(poly, sym));" call inside the condition so it was adding empty Graphic entries which for some reason was causing the color inconsistencies.  Thanks to @Kristian Ekenes as I discovered this in trying to create a sample of the code to post for debugging.  Thanks to everyone for your input, hopefully this post will help someone else debug this issue in the future if they make the same mistake!

0 Kudos