Formatting 'converted' point values
-
Hi,
If I have a point value I get from the Mango device, for example:
<ma-point-value point-xid="{{ Objects.BattCharge }}"></ma-point-value>
it returns22.5 %
When I add a
display-type=converted
such as:<ma-point-value display-type="converted" point-xid="{{ Objects.BattCharge }}"></ma-point-value>
the value often comes back as22.500000001
- is there any way to format the number that comes back via this point?The desired result is
22.5%
(without the space, and only to one decimal place).Thanks
Richard
-
Setting
display-type="converted"
will make it display the raw numeric value as you discovered. You want to use the rendered value which is controlled by the data point's text renderer. When you have the analog text renderer selected and "Use unit symbol as suffix" is set it inserts a space between the number and the unit symbol. If you want to get rid of this space, uncheck "Use unit symbol as suffix" and set the suffix manually. -
Found a different (better?) way to do this; find your data point initially and assign it to a variable:
<ma-get-point-value point-xid="{{ Objects.BattTemp }}" point="DispBattTemp"></ma-get-point-value>
then further down the page, use this array to grab the value, then filter it via the AngularJS built in
number
thus:<span ng-if="showBattTemp"> ({{ DispBattTemp.value | number:1 }}°C)</span>
Outputs 19°C as required. (Sorry, changed the data point from the initial example, but the theory is the same)
Cheers
Richard
-
The only down side seems to be that the
flash-on-change="true"
directive no longer works ... :( -
@richard-mortimer said in Formatting 'converted' point values:
The only down side seems to be that the flash-on-change="true" directive no longer works ... :(
Just one of quite a few reasons I recommended a different method.
-
@jared-wiltshire said in Formatting 'converted' point values:
@richard-mortimer said in Formatting 'converted' point values:
The only down side seems to be that the flash-on-change="true" directive no longer works ... :(
Just one of quite a few reasons I recommended a different method.
There are quite a number of people that work on our systems, with varying degrees of experience and knowledge. Whilst the
flash-on-change
might not be a valid reason to modify the final output, I'd be curious as to the other reasons, to see whether there would be valid reasons to suggest a change to this?Thanks
Richard
-
I really like the pop up of the
<ma-point-value point="myPoint1" enable-popup="up">
when enable pop is used.Not sure if you have tried it out yet. -
@richard-mortimer said in Formatting 'converted' point values:
I'd be curious as to the other reasons, to see whether there would be valid reasons to suggest a change to this?
If you change the suffix as I suggested you will see the change anywhere that the point value is displayed, i.e. on any dashboard (without explicitly formatting it), on any report, on any email, on any built in Mango page such as Watchlists etc.
You also get the benefits that
<ma-point-value>
provides such as the popup Craig mentioned, the flash on change, the unreliable indicator, the event indicator and the red cross hatching when the data point is disabled etc.