I tried several Javascript functions to get my Tooltip numbers rounded to the nearest integer but none work in Tooltips.
Anybody have a suggestion that really works?
Solved! Go to Solution.
Solved by ronnie.xue. Go to Solution.
Hi @John_DeLeeuw ,
this is a known behavior in InfraWorks with customized tooltips, it's always displaying 15 digits.
The only workaround, for now, is to convert the numbers to strings in the script.
Regards,
Karsten.
@Karsten.Saenger , can you provide an example script because normal javascript isn't fully working inside tooltips. I tried looking at the QT Developer Network site, mentioned here in the online help but could not find any working example.
My code now:
<script>
var num = %USER_HOOGSTE_GOOT%;
var text = num.toString();
var result = text.slice(0, 4);
</script>
And then try using the result in the HTML code write but that also seems difficult.
Hi @John_DeLeeuw ,
By default, the tooltip only supports simple HTML tags that outlined here - Supported HTML Subset | Qt GUI 5.15.8 so javascript is not working there.
To use javascript, you'll need to either include a <img> or <iframe> tag in the script so that full HTML support is activated. For instance, here's a trick to display area with 2 decimal places.
If only simple text is needed and the assets are imported, the conversion of tooltip can actually being done in import script in Data Source Configuration as well, for instance, here's how to set the tooltip of roads to the max speed with 2 decimal places
Can't find what you're looking for? Ask the community or share your knowledge.