03-28-2017 03:52 PM
I have a slider control representing a timespan:
Most of my tests involve time spans under a few minutes, but they can be as long as hours. Is there a way to specify the display format to output short relative time if hours or minutes are zero? For example:
20 seconds displayed as just 20
62 seconds displayed as 1:02
42 minutes 42 seconds displayed as 42:42
1 hour, 49 minutes, and 42 seconds displayed as 1:49:42
Etc..
Thanks,
XL600
Solved! Go to Solution.
03-28-2017 07:49 PM
It's possible to set the 'Marker Values' or to use text labels as markers. I'm not sure which would serve you better, but programmatically setting the values you want to display and changing the format appropriately should work out.
I attach a VI Snippet to demonstrate doing this with minutes and seconds.
03-28-2017 09:30 PM
The marker values have to be numeric with a format string, which seems to prevent truncating leading zeros when time is selected %<...>t. Is there a way to supply custom text in place of marker values?
03-28-2017 10:11 PM
My suggestion was that given you presumably know the length of the data, you can determine which you want (eg from a choice of "%<%H:%M:%S>t", "%<%M:%S>t" and "%<%S>t") and then call the property node with the format specifier. I don't know if you'll also need to change the limits of the scale or the numeric values via an array (like in my example).
To call it automatically, you could place this code with some checks on the maximum time of the data (assuming it starts at 0 - if not, the width of the data perhaps) and then call it each time you update the graph/chart/table, or once per minute, or similar. The less often you call it, the less impact it will have on your speed, but whether that matters to you depends on what else you're doing and your computer, I suppose. If you're already changing the limits based on the values in the graph/chart/table, then you should have the information readily available.
03-28-2017 10:16 PM
03-29-2017 09:10 AM - edited 03-29-2017 09:26 AM
I tried your suggestion as follows (This is my span select initializer called whenever my underlying run information changes):
Works pretty well and produces a pretty good display. I also tried the text label approach, but it was a bit more convoluted so I think I'll stick with the FormatString approach.
This did get me thinking... When dragging the slider, the small pop-up value display shows DBL. I wasn't able to find any format string property for that to get it to display in time mode. So, the value indicated while moving the sliders is disconnected from the slider labels when a time label is used.
Thanks for the tips!
03-29-2017 09:28 PM
@xl600 wrote:
This did get me thinking... When dragging the slider, the small pop-up value display shows DBL. I wasn't able to find any format string property for that to get it to display in time mode. So, the value indicated while moving the sliders is disconnected from the slider labels when a time label is used.
Ah. That's a little frustrating, but I suppose it's just a reflection of the actual value stored. If you don't like it, you can remove it, but I can't find a way to change what it reads.
If you want to hide it, you need to either right click, go to properties, and untick 'Show value tip strip', or use a property node to set the same property to false. You won't need to do it each time you refresh though - just when you create it (so the right click should be simpler).
03-30-2017 08:16 AM
Thanks again! After hiding the tip strip, I realized the digital displays can be separately formatted. You can't change the basic recessed look of the 'modern' control, but this is a pretty good way to display:
All I had to do is tie the format strings together...
03-30-2017 12:58 PM
@xl600 wrote:
Thanks again! After hiding the tip strip, I realized the digital displays can be separately formatted. You can't change the basic recessed look of the 'modern' control, but this is a pretty good way to display:
All I had to do is tie the format strings together...
Did you try to customize the control?
Advanced >>> Customize
Click the wrench and change it to blow torch
Right click the control and choose "replace" then navigate to the classic simple numeric.
Ben
03-30-2017 01:20 PM
Always some way to do it
Looks great now!
Thanks!