Select to view content in your preferred language

Can SimpleLineSymbol have a width smaller than 1?

1371
5
Jump to solution
02-01-2012 08:14 AM
MikeOnzay
Regular Contributor
The API states the width is in pixels. I have tried numbers smaller than 1 (0.5, 0.25, 0.05) and my lines, or outlines to my SimpleFillSymbols are still very wide. Is there another solution? I'm using a featurelayer.
0 Kudos
1 Solution

Accepted Solutions
derekswingley1
Frequent Contributor II
The parameters for SimpleFillSymbol constructor are style, outline and color. For simple fill symbols, style specifies the fill style. To work with the outline, you tweak the line symbol used by the fill symbol. Make sense?

There is an old demo (released with v1.1 of the API, I think) I still use from time to time to generate code for various symbols:  http://serverx.esri.com/ArcGISJavaScriptAPI/CodeGallery/graphic_symbology.html

You almost always have to further tweak the JS generated there but it's a nice place to play around.

View solution in original post

0 Kudos
5 Replies
derekswingley1
Frequent Contributor II
Please post some code to show what you're doing.
0 Kudos
MikeOnzay
Regular Contributor
this is what I was doing:

var symbol = new esri.symbol.SimpleFillSymbol(esri.symbol.SimpleFillSymbol.STYLE_SOLID,
     new esri.symbol.SimpleLineSymbol(esri.symbol.SimpleLineSymbol.STYLE_SOLID,
     new dojo.Color([0,0,0],0.1)),
     new dojo.Color([100,149,237,0.15]));


Then, after posting the original question, I changed the line style from STYLE_SOLID to NULL

var symbol = new esri.symbol.SimpleFillSymbol(esri.symbol.SimpleFillSymbol.STYLE_SOLID,
     new esri.symbol.SimpleLineSymbol(esri.symbol.SimpleLineSymbol.NULL,
     new dojo.Color([0,0,0])),
     new dojo.Color([255, 255, 0,0.15]));


and the polygon displays with the thin line that I expected to see in the first place. But, it doesn't make sense to me why it works because the API states that NULL means "The line has no symbol".
0 Kudos
derekswingley1
Frequent Contributor II
The parameters for SimpleFillSymbol constructor are style, outline and color. For simple fill symbols, style specifies the fill style. To work with the outline, you tweak the line symbol used by the fill symbol. Make sense?

There is an old demo (released with v1.1 of the API, I think) I still use from time to time to generate code for various symbols:  http://serverx.esri.com/ArcGISJavaScriptAPI/CodeGallery/graphic_symbology.html

You almost always have to further tweak the JS generated there but it's a nice place to play around.
0 Kudos
MikeOnzay
Regular Contributor
It makes sense. And, thanks for the link to the demo!
0 Kudos
derekswingley1
Frequent Contributor II
Good stuff. And thanks for marking my post as an answer.
0 Kudos