Jump to content
Software FX Community

IGSFX

Staff
  • Posts

    156
  • Joined

  • Last visited

Posts posted by IGSFX

  1. Currently, groups use a single gadget to display different pieces of data. Real dashboardng capabilities is one of the features we will probably add in a future version of PowerGadgets. In the meantime, PowerGadgets honors the desktop locaion and sizes, but that's about it. We have an interim alpha build that allows you to close/hide all of the gadgets at the same time, and is like the basis for a future dashboard feature. If you want to try that build please contact us at support@online.powergadgets.com (remove online)

    post-4878-13922403368262_thumb.jpg

  2. The ideal solution for your case would be an out-grid gadget, showing the data in the form of a table. This is something we have started to play with, and already have a very basic out-grid cmdlet, unsupported at this time. You must be aware that it's a very basic experiment, which doesn't even support auto-refresh at this time. Anyway, if you want to play with this unsupported cmdlet, please contact us at support@online.powergadgets.com (remove online).

  3. It seems that the pieces needed to uninstall the software are somehow missing. The two key parts to uninstall PowerGadgets are the uninstaller program, called Uninsfx_x64.exe, located in <Programs Files>\Common Files\Install FX, and the installation log, called PowerGadgets_Trial_x64.ifx (or a similar name with the .ifx extension), located in the PowerGadgets installation directory, typically <Program Files>\PowerGadgets.

     

    Please check which of the pieces is missing. Most of the times, a reinstall should replace the missing file.

  4. You can also use the Template Creator (out-gauge -config) to decide the best location with the mouse and also avoid some typing [;)]

     You will finally invoke something like this:

    (ps).count | out-gauge -template MyTemplate -refresh 0:0:2

    You can even make the refresh rate part of the template if you want. 

    IvanGPowerGadgets

  5. When you create a gadget using the PowerGadgets Creator there are two main elements combined: data and gadget properties (type, look, etc.). In order to convert a pgf gadget to a ps1 gadget you must separate the two portions.

    First, to obtain the gadget properties you can use a feature in PowerGadgets which allows you to use the clipboard to pass gadgets from the Creator to Template Creator and viceversa. You must first open your pgf gadget and click Edit->Copy. Then you open the Template Creator by invoking out-map -config in PowerShell (or out-gauge/out-chart depending on your gadget type). This will invoke a UI very similar to the PowerGadgets Creator but will not allow you to pass any data, since you are defining a template. Click Edit->Paste and you will have a template with the same look of your original gadget, which you will save as a .pgt file (e.g. MyTemplate.pgt). You don't need to to any of this if your gadget uses the default properties.

    Second, you will move the data section from your pgf gadget to the ps1. If you are using PowerShell data, this is as simple as copy/paste from the Creator data section into your ps1 file. If you are using databases or web services, then you must use the corresponding cmdlets (invoke-sql or invoke-webservice).

    Finally, you will combine both pieces in your ps1. For example, if your original gadget was a map of the US Election results reading a csv file using PowerShell, your final ps1 will look like this:

    import-csv USElectionResults.csv | select StateAbbreviated,@{Expression={[int]$_.Bush};Name="Bush"},@{Expression={[int]$_.Gore};Name="Gore"} | out-map -template MyTemplate.pgt

    You also mention that you want to combine several gadgets into a single pane, which we call a gadget group. In order to do that, you must use the -group MyGroup -name <gadgetName> parameters when invoking the cmdlet. It's important to mention that you can also achieve groups with the PowerGadgets Creator by simply adding more gadgets to your pgf file, using the Edit->Add Item option or the + icon in the toolbar.

    It would be interesting if you please elaborate on what kind of "more programmatic control over the display of the map" you are looking for.

    IvanGPowerGadgets

  6. We have this in our wish list for a future version, however you can achieve it today with out-map, a custom map and conditional attributes. We include a sample showing the status of servers (online/offline) in red or green. Similarly, it can be customized for more colors. I will try to create a post blog showing how to do it later this week.

    Would you prefer it with a single "bulb" changing colors or rather three "bulbs" like a real traffic light? Vertical or horizontal?

    IvanGPowerGadgets

  7. One question we receive sometimes from our customers is how to integrate PowerGadgets charts, maps or gauges within their websites. Although this is possible with no much effort, I would like to emphasize that this solution does not replace a fully-featured server-side component, with the ability of detailed programming and integration with your web applications, as well as interactive data visualization in the browser. In that case, a complete web component such as Chart FX will do a much better job.

    Integrating PowerGadgets with your website is as simple as integrating any image in your web page. Then, you update that image from a script using PowerGadgets, at the refresh rate you desire. If you want the image to refresh automatically on the browser, you will need to use your own webpage refresh technique. Using the chart we created in a previous blog post, I will show you an example of how to create a page that shows a chart of the processes running on a server, updated every 5 minutes.

    First, you must insert an image tag in the webpage that will contain the chart, for example <IMG src="pgChart.png" mce_src="pgChart.png">. Then, you must create the image using the PowerGadgets output parameter, which exports the gadget to an image file. The file type is determined automatically by its extension (png, jpg or bmp). Your PowerShell command is the following:

    ProcessesWithTime | out-chart -dataobject Processes -values CPU -label Name -titles_0_text {$_.DateTime} -output "C:\Inetpub\wwwroot\pgChart.png"

    In this sample we are assuming that the PowerShell command is running on the same computer as the webserver. If this is not the case, you can export the image to a temporary file and then upload it to the webserver using a PowerShell ftp cmdlet or another remote upload procedure you may choose.

    The second step consists of creating a new image at the desired interval of 5 minutes. The first thought that may come to your mind is using the PowerGadgets native refresh capabilities, used in many other occasions previously. However, the refresh parameter is ignored when the output parameter is used. The main reason for this is that typically you don't want to see the chart on the screen when you export it to a file; therefore, leaving a chart refreshing itself in the background could bring up some major issues such as the lack of a proper UI to close the process. For such reason, we will use instead the Windows Task Scheduler to invoke PowerShell, although you could replace it with your favorite scheduling tool.

    We will use PowerShell's ability to receive a script as a parameter to automate the process, by creating a ProcessWithTimeImage.ps1 file with the command line shown above. Also, you will need to add the PowerGadgets snapin to the PowerShell session, which can be done in either one of the following ways:

    1) Insert the following as the first line of your ProcessWithTimeImage.ps1 file: add-pssnapin PowerGadgets
    2) Invoke PowerShell with the PowerGadgets.psc1 file as a parameter. This is the option we will use in this sample.

    The command you must invoke from your Task Scheduler is the following:

    <Windows installation folder>\System32\WindowsPowerShell\v1.0\powershell.exe -PSConsoleFile "<PowerGadgets installation folder>\PowerGadgets.psc1" ProcessWithTimeImage.ps1

    After setting the appropriate refresh period in your scheduling tool, you will have a new chart with the processes running on the server, updated every 5 minutes. If you hit the refresh button on the browser, you will see a new image when the period has elapsed. If you want to avoid hitting the refresh button to obtain a new image, you can refresh the page automatically at the desired refresh rate, usually the same as the chart is generated. You can even use AJAX to refresh the image without the need to refresh the page. Here is a sample created by one of our web guys, which nicely refreshes the chart image every 5 minutes, with a cool transition:

    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
    <html>
    <head>
    <title>PowerGadgets Real-Time Sample</title>
    <script type="text/javascript">
    var PG_iRefreshInterval =5000; // Refresh interval in Milliseconds
    var pgStatusMsg = " "
    var pgSwappableSection = new Image();
    var pgIntAttach = 0;
    var pgRefreshTimer;
    var pgInitImgSrc;
    var pgImgObj;

    function PG_HideStatus() {
    window.status=pgStatusMsg;
    return true;
    }

    function PG_ImageLoaded(mysrc) {
    var targetChart = pgImgObj;
    pgImgObj.style.filter="blendTrans(duration=.3)"
    pgImgObj.filters.blendTrans(duration=.3).Apply();
    pgImgObj.filters.blendTrans.Play();
    pgImgObj.src = mysrc;
    PG_HideStatus();
    }

    function PG_RefreshGadget() {
    pgSwappableSection.src = pgInitImgSrc + "?attchVar=" + pgIntAttach;
    pgIntAttach ++;
    pgSwappableSection.onLoad=PG_ImageLoaded(pgSwappableSection.src);
    }

    function PG_InitRefreshGadget(pgImg) {
    pgImgObj = pgImg;
    pgInitImgSrc = pgImg.src;
    pgRefreshTimer = self.setTimeout("PG_RefreshGadget()",PG_iRefreshInterval);
    }
    </script>
    </head>
    <body>
    <IMG src="pgChart.png" mce_src="pgChart.png" name="imgPGRefresh" id="imgPGRefresh" onload="PG_InitRefreshGadget(this)" >
    </body>
    </html>

    There is still an enhancement that can be made to this sample, which is to avoid showing the PowerShell window everytime the script is invoked. I will leave this as a homework for the reader, at least until I have time to figure it out :-)

    IvanG

  8. If you want to connect PowerGadgets to CSV data, the easiest way to do so is using the import-csv cmdlet included with PowerShell. For example, let's assume you have a Sales.csv file with Units and Amount sold per Month, with the following data:

    Sales.csv
    Month,Units,Amount
    January,1723,134561.35
    February,2167,141289.90
    March,2541,165182.18
    April,2643,190781.36
    May,2434,175111.85
    June,2934,204518.71
    July,2338,163779.05
    August,1834,136528.49
    September,2840,188787.35
    October,2612,187614.22
    November,2411,190993.00
    December,3025,211743.80

    The first try to plot such data is running the following PowerShell command:

    import-csv Sales.csv | out-chart

    However, this will show an empty chart:

    /TeamBlogImages/ConnectingtoCSVdatafromPowerGadgets_59F0/NoDataAvailable.jpg

    The reason for this is that import-csv returns every field as a string, so PowerGadgets cannot know automatically which fields contain plottable data. PowerGadgets has the capability to cast any field to a number, when you specify which fields to plot using the -values parameter. You can also specify which field should be used as the X axis label with the -label parameter. The second try gives you the chart you want:

    import-csv Sales.csv | out-chart -values Units,Amount -label Month

    /TeamBlogImages/ConnectingtoCSVdatafromPowerGadgets_59F0/CsvChart2.jpg

    Connecting to CSV data from the PowerGadgets Creator

    The PowerGadgets Creator UI doesn't support the casting from strings capability (this is something we might enhance in a future version). For such reason, a different approach must be taken. Through the use of PowerShell's scriptblock capabilities, you can return an object that can be understood by the Creator. The PowerShell command to invoke from the PowerGadgets Creator data section is the following:

    import-csv Sales.csv | select Month,{$_.Units},{$_.Amount}

    /TeamBlogImages/ConnectingtoCSVdatafromPowerGadgets_59F0/CsvChartFromScriptblock_thumb.jpg

    This is almost the chart you want to obtain, but it's not quite there yet. If you review carefully, the chart legend shows $_.Units and $_.Amount because it's using the string passed to the series. To overcome this issue, we resource to a capabilty in the scriptblocks which is honored in PowerGadgets. Your final command is the following:

    import-csv Sales.csv | select Month,@{Expression={$_.Units};Name="Units Sold"},@{Expression={$_.Amount};Name="Sales Amount"}

    /TeamBlogImages/ConnectingtoCSVdatafromPowerGadgets_59F0/CsvChartFromScriptblock2_thumb.jpg

    IvanG

  9. In a previous post we exposed how the out-chart and out-map cmdlets support scriptblocks in parameters that specify fields, such as -values. We also showed how it is also supported in almost any out-gauge parameter. However, support for scriptblocks in other chart/map parameters was not available at the time the blog entry was written.

    We have recently added support for scriptblocks in almost any chart/map parameter, but some additional configuration is required to use it. Let me start explaining how PowerGadgets plots the data received from a PowerShell pipe. Unlike gauges, which normally display one value at the time, charts and maps are used to display a number of values. Based on that fact, PowerGadgets inspects the piped data and plots all numeric properties found, unless you select one or more fields (properties) through the -values and -label parameters. For example, if you want to create a chart of the CPU used by the running processes, you can execute the following command:

    get-process | out-chart -values CPU -label Name

    Resulting in the following chart:

    Posted Image

    On the other hand, if you want to use another property of the piped data in a chart parameter, for example the chart title, you would need to pass one value instead of a collection of values, because otherwise the chart wouldn't know which of the members of the collection should be used. To illustrate this case, let's say for a moment that you want to create the same chart shown before but refreshed every five seconds. Also, the chart title will be used to show the last time the data was acquired. For such purpose, let's create the ProcessesWithTime.ps1 script as follows:

    $datetime = get-date
    $processes = get-process

    $obj = new-object System.object
    add-member -inputobject $obj -membertype NoteProperty -Name DateTime -value $datetime
    add-member -inputobject $obj -membertype NoteProperty -Name Processes -value $processes
    $obj

    Essentially this script creates a new object with a property containing the current date & time and another property with a collection of Process objects. If you pipe the script to an out-chart cmdlet you will get a "No data available" message, since PowerGadgets could not find any numeric property in the piped data. Therefore, you need to specify which of the object's properties contains the data to be plotted, through the -DataObject property. You can now invoke the following:

    ProcessesWithTime | out-chart -dataobject Processes -values CPU -label Name

    Now, let's add the current datetime to the chart's title and refresh it every 5 seconds:

    ProcessesWithTime | out-chart -dataobject Processes -values CPU -label Name -titles_0_text {$_.DateTime} -refresh 0:0:5

    Now, every 5 seconds your chart will be refreshed with current running processes data and the time shown in the title as follows:

    Posted Image

    There are many uses for scriptblocks in chart parameters such as the value of a CustomGridLine or setting colors based on conditions not related to the data being plotted (such as in the RandomData example of our previous scriptblock post), among others.

    Note: this feature was added in the PowerGadgets build 1.0.2595, which was not publicly available at the time of posting this blog entry. If you want to get an interim build containing this feature, please contact our tech support (see website for details).

    IvanG

  10. The Windows PowerShell RTW installers for Windows Vista RTM are already available for free download:

    Download Windows PowerShell 1.0 Installation for X86 Edition
    Download Windows PowerShell 1.0 Installation for X64 Edition

    Further details can be found in the PowerShell Team blog.

    We recommend installing Windows PowerShell prior to installing PowerGadgets in order to take advantage of some features that are only available through the use of the PowerGadgets cmdlets. However, the PowerGadgets Creator allows the creation of gadgets connecting to databases and web services without the need of Windows PowerShell.

    IvanG

×
×
  • Create New...