-1

Using ArcMap, I've made a map with graduated colours, labeling them with the same attributes value.

The colours display correctly, but the labels don't show the negative sign.

For example: Red area has a value of -2.769. It's the lowest, but the label shows it without the negation, So it appears as though it has the highest value (2.769).

map Edit: I didn't understand where did I do wrong. So I made everything from scratch. Now, it's working.

closed as off-topic by PolyGeo Apr 19 '18 at 13:13

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "This problem cannot or can no longer be reproduced. Changes to the system or to the asker's circumstances may have rendered the question obsolete, or the question does not include a procedure to enable potential answerers to reproduce the same symptoms. Such questions are off-topic as they are unlikely to help future readers, but editing them to include more details can lead to re-opening." – PolyGeo
If this question can be reworded to fit the rules in the help center, please edit the question.

  • That's very strange... how do you handle the labeling? are you using maplex? – Vale Dec 1 '15 at 11:21
  • I'm very new at this. I don't even know what a maplex is. :) I just clicked Layer properties>labels>selected my column name in label field. and then clicked apply. The graduated colors in symbology is working perfectly so I'm assuming there is nothing wrong with attributes. I couldn't apply the other answer because I don't know any coding. – gulyuks Dec 1 '15 at 12:37
  • I've never experienced that, it seems that there is a problem with the labeling field. – Vale Dec 1 '15 at 13:05
  • @gulyuks what your field format? Labeling use string to result. Consequently you can cast value to text in your labelling unicode([Your_Field]) if you are feature is stored in utf-8 (by default since 10.3) or str([Your_Field]) if you are feature is stored iso8859-1 or other system encoding (non unicode) – GeoStoneMarten Dec 2 '15 at 11:10
1

If you double click on the layer in the layer control, a dialogue will come up with multiple tabs. Select the labels tab on these properties, Click expression (label expression?), click the advanced check box and set the parser to python

def negateLabel ( [attributeName] ):
    attributeVal = int(attributeName)
    if attributeVal  < 0:
        return "- " + [attributeName]
    else:
        return [attributeName]

You may have to play around as I don't have ArcMap to hand and the python might be wobbly, but it would be good for you to play around with it, for that's pretty much on the money.

  • it says; "The expression contains an error. Modify the expression and try again. Error 0 on line 0. SyntaxError: invalid syntax(<string>, line 1)." I played around little bit but it gives same error. – gulyuks Dec 1 '15 at 8:40
  • Remove the int part if it is coming across as an Int – Hairy Dec 1 '15 at 13:59
  • Also, make sure your python is correctly indented; each line has to be 4 spaces indented, so after and if, it has to be 8, etc, etc – Hairy Dec 1 '15 at 14:00
1

You can try with this VBScript function. Set the parser to be VBscript instead of Python:

Function FindLabel ( [your_field]  )
if ([your_field] < 0) then
FindLabel = "-"+ [your_field]
else
FindLabel = [your_field]
end if
End Function

Your field must be numeric. Is your field numeric or text?

  • It says "this expression is valid". But still doesn't show negative sign. It's numeric. – gulyuks Dec 1 '15 at 13:21
  • It's numeric. I changed the number format to numeric and added thousand seperator and changed rounding>number of decimal places=0 – gulyuks Dec 1 '15 at 13:30
  • what happens if you click with the identify tool on the red polygon? do you get the right attribute? – Vale Dec 1 '15 at 13:35
  • Yes. It's -2.769 – gulyuks Dec 1 '15 at 14:19
  • Have you tried to open your map in a new project? Could you please verify if you have maplex labeling turned on? Go to Customize -> toolbars -> labeling. Then try to turn on/off use maplex label engine. – Vale Dec 2 '15 at 8:36

Not the answer you're looking for? Browse other questions tagged or ask your own question.