symbolPreview not working with fill symbols

522
2
04-06-2018 09:54 AM
BorisLutskovsky
New Contributor II

I'm having some issues using the symbolPreview for any fill symbols. it works fine for simple-marker, but if I use a simple-fill symbol, nothing renders and I get a 404 error for https://js.arcgis.com/4.6/esri/symbols/patterns/solid.png 

var s = new Symbol({
  type: 'simple-marker',
  color: 'red',
  size: 12
}); //this works.
var s2 = new Symbol({
  type: 'simple-fill',
  style: 'solid',
  color: 'red'
}); //this doesn't work. 
symbolPreview.renderPreviewHTML(s, {
node: element.getElementById("preview"),
size: s.size ? s.size : 12
});
Tags (1)
0 Kudos
2 Replies
JoseBanuelos
Esri Contributor

Boris,

Try commenting out the following line: "style: solid" from the fill symbol. I was receiving the same display issue, but without the 404 error until I removed the style property.

BorisLutskovsky
New Contributor II

thank you. that worked for me as well. But I can't understand why it worked.

and obviously deleting a property of the object after creating it is not optimal.