Version 1

    Thanks to this post I was able to re-write some code for a simple Custom HTML Widget that can modified relatively easily to create some pie chart widgets.

    So, thank you wluther for the code and allowing me to quickly learn some AJAX / Google Charts API to adapt to something less robust than a nested charts and a calendar view of alerts by day.

     

     

    From line 5 of the attached file:

     

    Modify this SWQL query to your liking, biggest piece is it should be 2 columns only here I have Machine Type and Qty (Count of NodeID's per Machine Type)

    In this Query I have explicitly called out the Machine Types I care about

    var swql="SELECT n.MachineType, count(n.NodeID) as Qty FROM Orion.Nodes as n Where n.MachineType = 'IBM PowerPC' OR n.MachineType = 'net-snmp - Linux' OR n.MachineType LIKE 'Red Hat%' OR n.MachineType LIKE 'Windows 20%' OR n.MachineType like 'Sun Microsystems%' OR n.MachineType like '%Unknown%' GROUP BY n.MachineType ORDER BY Qty DESC"

     

     

    From lines 31-34 of the attached file

     

    This will go through each row of the results from the SWQL query and add it to a row for the pie chart.

    I needed to modify the "var row = " line to below

    for(var i=0; i < response.d.Rows.length; i++){
    var row = [response.d.Rows[i][0],response.d.Rows[i][1]];
    dataTable.addRow(row);
    }

     

    From lines 38-44 Chart options were modified. You can get all the options from Googles site on this: Google Charts

    var options = {
                title: 'Operating Systems',
                colorAxis: {colors:['#86ce76','#d61007']},
                                legend: {position: 'right'},
                                tooltip: {trigger: 'selection'},
                                chartArea:{left:2,top:2,width:500,height:500},
                };

     

    From lines 52-54 some modifications to the DIV at the end to make it match a size I felt was good

     

    <div id="container" style="width: 500px; height: 215px;">
    <div id="server_os" style="width: 500px; height 215px;"></div>
    </div>

     

    With this you'll be able to; hopefully, modify the code to your liking for the SWQL Query as well as what chart you would like.