sstranger Posted September 24, 2007 Report Share Posted September 24, 2007 Would it be possible to have dates in out-gauge horizontal? Like: 01-01-2007 02-01-2007 12-31-2007 Regards, Stefan Strangerhttp://weblog.stranger.nl Quote Link to comment Share on other sites More sharing options...
marco.shaw Posted September 24, 2007 Report Share Posted September 24, 2007 It takes some playing around with the Creator, but check out the attached. Date0/1/2 can be pretty much replaced with any string. Quote Link to comment Share on other sites More sharing options...
sstranger Posted September 25, 2007 Author Report Share Posted September 25, 2007 Hi Marco, Are the dates dynamic? Regards,Stefan Strangerhttp://weblog.stranger.nl WebApplication1.zip Quote Link to comment Share on other sites More sharing options...
marco.shaw Posted September 25, 2007 Report Share Posted September 25, 2007 The dates are static the way I set them up, but I believe you could set them up dynamically in the XML of the template file. How will the gadget be used? Will it be restarted every so often, for example? The gadget would have to be closed/reopened for the dates to get adjusted with the method I'm thinking of (if it works). Quote Link to comment Share on other sites More sharing options...
IGSFX Posted September 25, 2007 Report Share Posted September 25, 2007 If I understand correctly, you want to be able to plot dates in a linear gauge instead of numbers, e.g. the scale min is 01/01/2007, the scale max is 12/31/2007 and you want to plot today's date. Linear and radial gauges don't accept dates as values/min/max, but you can do a couple of tricks to achieve what you want, using PowerShell and the .NET Framework. First, you need to convert your dates into doubles, by using .NET's Convert.ToOADate, which converts a datetime into its corresponding double. Then, you can customize the scale's labels to show the dates you want instead of the numbers. The following code assigns 01/01/2007 as the scale's min and 12/31/2007 as the scale's max, and today's date as the plotted value (I assume today's date is a day in the year 2007). $min = [Convert]::ToDateTime("01/01/2007")$max = [Convert]::ToDateTime("12/31/2007")$today = get-date out-gauge -type horizontal -mainscale_min $min.ToOADate() -mainscale_max $max.ToOADate() -value $today.ToOADate() -mainscale_MaxAlwaysDisplayed true -mainscale_CustomLabels_39083 "01/01/2007" -mainscale_CustomLabels_39447 "12/31/2007" -mainscale_tickmarks_major_step (39447-39083) The numbers 39447 and 39083 that seem to appear magically are the representation as double of $min and $max ($min.ToOADate and $max.ToOADate). I'm setting the step so no intermediate labels appear, but you can tweak it to show whatever you want, just making sure that you assign the appropriate customlabels to avoid showing a number. It's important to be aware of that you are actually passing a number, which will appear in places like the tooltip. You can customize your tooltip to show the actual date plotted by adding -mainindicator_tooltip $today.This is not a perfect solution, but I hope it helps. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.