Bug report #5726

Labelling: number formatting does not work for expressions

Added by Leyan Ouyang over 7 years ago. Updated over 6 years ago.

Status:Closed
Priority:Normal
Assignee:Nathan Woodrow
Category:Labelling
Affected QGIS version:master Regression?:No
Operating System: Easy fix?:No
Pull Request or Patch supplied:Yes Resolution:fixed
Crashes QGIS or corrupts data:No Copied to github as #:15240

Description

On the new labelling engine, there is the possibility to format numbers by limiting the decimal places and adding a + sign if the number is positive. However, it only works when choosing directly a field, not after the evaluation of an expression. This is especially an issue for $length that comes with a very impressive but quite useless precision and makes for unreadable labels by default. It also leads to some counter-intuitive behavior where choosing an expression like "value" does not give the same result as choosing the field "value".

I join a patch that extends the ability to format number to the expressions.

label_number_formatting_expression.diff Magnifier - patch to format result of expressions in labeling (1.83 KB) Leyan Ouyang, 2012-06-03 03:50 AM

History

#1 Updated by Giovanni Manghi over 7 years ago

  • Assignee set to Nathan Woodrow

#2 Updated by Paolo Cavallini about 7 years ago

  • Target version set to Version 2.0.0

#3 Updated by Nathan Woodrow over 6 years ago

  • Resolution set to fixed
  • Status changed from Open to Closed

There is now a format_number function in master.

#4 Updated by Larry Shaffer over 6 years ago

Hi,

Issue should also be fixed with 45f374f

Also available in: Atom PDF