Community Tip - Need to share some code when posting a question or reply? Make sure to use the "Insert code sample" menu option. Learn more! X
I've built Vuforia Studio App that's using ThingWorx services and my AR app demonstrates Thingworx Thing's Parameter value in Vuforia 3D Gauge .
Parameter (its value) is transported from TWx to Studio project well, but I cannot restrict very long decimal part of the parameter's value for Studio visualization in 3D Gauge. In ThingWorx it has two integer digits and 6 decimal but my Studio Gauge can show no more than 3-4 digits at all. How can I round XX.XXXXXXX value from TWx to XX.XX in Studio ? Could I roung XX.XXX from ThimgWorx to integer value (XX) for Studio project purposes?
Solved! Go to Solution.
You can use a filter for that. Select the gauge widget, and in the bottom panel you should see the data binding. Click the Add Filter button, and put something like this in the filter:
return value.toFixed(2);
That should round to 2 decimal places.
You can use a filter for that. Select the gauge widget, and in the bottom panel you should see the data binding. Click the Add Filter button, and put something like this in the filter:
return value.toFixed(2);
That should round to 2 decimal places.
Hello Clay,
ThanXs for explanation - it works. (see attached file with Studio Preview)
And according your explanation we apply yet another filter
return Math.round(value);
for rounding (float) value to integer value in our example. An d it works too.
Thank You!