Controlling Format of Text and Numbers
You can make a wide range of precise changes to the appearance of text and numbers in scenes and Viewer file exports, using either a dialog or the number format.
Controlling Formats with the Dialog
A dialog lets you make changes to text and numeric labels that are displayed in scenes and Viewer file exports. To work with the dialog:
-
Click
(Custom Editor) in any of the following:
- The Label Format property of the Color Bar node in scene displayers
- The Default Solution Time Format property of the Iteration and Solution Time annotations
- The Number Format property of the report annotation
- The Format property of the node
Note When you add the Iteration or Solution Time annotation to a scene, the applied annotation node in the scene has a Solution Time Format property. This property lets you customize the annotation format for the particular scene. This action activates the format dialog. The following example works with the color bar, so its title is Color Bar - Label Format.
- To adjust the appearance of the labels, use the options in the
Overall Formatting group box:
- To justify the labels toward the left end of the color bar, activate the Left-Justified Labels checkbox.
- To indicate whether the values are positive or negative, activate the Print Sign checkbox.
- To include zeros at the left of the labels (for a uniform number of digits), activate the Zero Padding checkbox.
- To display decimal points for all numbers, including integers, activate the Print Decimal Point checkbox.
- To specify the minimum number of digits overall, and the number of digits after the decimal point, use the text boxes in the Precision Options group box. Press <Enter> after making an entry in each of these text boxes.
- In the
Style Options group box, select a style from the drop-down list:
- Best Fit - this default option presents the data in a visually optimal manner.
- Decimal - this option displays the full decimal values based on the entry in the Number Decimal Digits text box.
- Scientific - this option displays the values in scientific notation. To use an uppercase “e”, activate the Use Upper Case checkbox.
What Is the Number Format?
The Number Format property of the report annotation, which is similar to the Default Solution Time Format property of the Iteration and Solution Time annotations, is used to convert the value to a suitable display format.
Note | When you add the Iteration or Solution Time annotation to a scene, the applied annotation node in the scene has a Solution Time Format property. This property lets you customize the annotation format for the particular scene. |
The property is entered as text and should follow the pattern:
%[flags][width][.precision]specifier
where the elements in brackets are optional, and the specifier is a character that indicates the style of format required. The table below provides the accepted values for each element.
For report annotations, the measurement unit appearing on the display is defined by the report itself.
flags | An optional element that controls some overall format behavior. | |
- | An optional character that will cause the converted value to be left-justified within the width of the output. | |
+ | An optional character that will place + or - in front of the output value. | |
0 | An optional zero that will pad unused digits in front of the output with 0’s. | |
# | An optional character that will cause the decimal point to be printed even when no nonzero digits follow. | |
width | The minimum number of characters to be printed in the output value. If the output value has fewer characters than the field width, it will be blank-padded on the left (or right, if the - flag has been given) to make up the width. If the 0 flag has been given, 0’s will be used for padding instead of blanks. | |
.precision | An optional period followed by a number that specifies the number of digits to appear after the decimal point. For example, .3 would mean that three digits will appear after the decimal point in the output value. | |
specifier | A character that indicates the style of output required. | |
f | The value will be output in the form [-]m.ddd where the mantissa m will have as many digits as it needs, and the number of d’s after the decimal point is given by the precision. Six d’s will be used if the precision has not been set. | |
e | The value will be output in scientific notation, that is [-]m.ddde+xxx or [-]m.ddde-xxx. The mantissa, m, consists of one digit, and the number of d’s is set by the precision (six if not given). | |
E | Same as e, but with an uppercase E to identify the exponent. | |
g | Use either f or e depending on which style will give the greatest precision in minimum space. | |
G | Same as g, but with an uppercase E used to identify the exponent (if present). |
Some examples of the effect of these formats on a report value are as follows:
Report value = 467699.65625 Pa
Number Format | Output | Comment |
%f | 467699.656250 (Pa) | Default number of d’s after decimal point (six). |
%6f | 467699.656250 (Pa) | Width of 6 has no effect as more than six digits are present |
%10.2f | 467699.66 (Pa) | One blank inserted at start to pad number to full width of 10 characters. |
%+012.2e | +004.68e+005 (Pa) | + symbol inserted for positive number; 0’s used to pad output to full width of 12 characters. |
%8.3E | 4.677E+005 (Pa) | Three digits after decimal point; no padding required. |