Defects by Severity

Deprecation Warning! The content below is only applicable for use within deprecated 1.x versions of CA Agile Central's App SDK. Use of the component(s) and/or code on this page is not supported. To develop custom apps within our current environments, please see App SDK 2.0 documentation.

This example demonstrates the integration of multiple components through the SDK's standard-component, event-handling framework.
A pie chart displays all defects states by severity and you can view details by selecting each slice.

defects by severity

Example code

Copy and paste the following into a CA Agile Central custom page.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<!-- Copyright (c) 2010 CA Agile Central Software Development Corp. All rights reserved -->
<html>
<head>
   <title>Defects BySeverity Example</title>
   <meta name="Name" content="App Example: Defects By Severity" />
   <meta name="Version" content="2010.4" />
   <meta name="Vendor" content="CA Agile Central Software" />

   <script type="text/javascript" src="/apps/1.26/sdk.js"></script>
   <script type="text/javascript">

    function showDefects() {

       var rallyDataSource = new rally.sdk.data.CA Agile CentralDataSource('__WORKSPACE_OID__',
                                 '__PROJECT_OID__',
                                 '__PROJECT_SCOPING_UP__',
                                 '__PROJECT_SCOPING_DOWN__'
);
       var wait;
       var table;
      var severityPieConfig = {
         title : "Defects by Severity",
        type : "Defect",
         attribute: "Severity",
        height : 400,
        width : 400
        };

       var severityPieChart = new rally.sdk.ui.PieChart(severityPieConfig, rallyDataSource);
       severityPieChart.display("severityPie");
       severityPieChart.addEventListener("onSliceClick",
         function(p, eventArgs) {
         refreshTable(eventArgs.label);
         });


      function showTable(results) {
        wait.hide();
        if(table) {
         table.destroy();
        }
        var config = {
         columnKeys: ['FormattedID', 'Name', 'Priority'],
         height: "300px",
         width: "300px"
        };
        table = new rally.sdk.ui.Table(config);
        table.addRows(results.defects);
        table.display("defects");
       }

      function refreshTable(severity) {
        document.getElementById("defectsTitle").innerHTML = "Defects with Severity = " + severity;
        wait = new rally.sdk.ui.Wait();
         wait.display("defects");
        var queryObject = {
         type : 'defect',
         key : 'defects',
         fetch: 'Name,FormattedID,Priority',
         query: '(Severity = "' + severity + '")'
        };

        rallyDataSource.findAll(queryObject, showTable);
       }
     }

    rally.addOnLoad(showDefects);

  </script>
</head>
<body>
   <table>
     <tr>
       <td valign="top">
         <div id="severityPie" style="height:425px; width:450px;"></div>
       </td>
       <td style="height:425px; width:450px" id="defectContainer" valign="top">
         <div id="defectsTitle" style="text-align:center; width: 100%; font-size:16px; margin-bottom: 20px"></div>
                 <div id="defects" style="height:350px; width:450px;"></div>
       </td>
     </tr>
  </table>
</body>
</html>

Feedback

Need more help? The CA Agile Central Community is your one-stop shop for self-service and support. To submit feedback or cases to CA Agile Central Support, find answers, and collaborate with others, please join us in the CA Agile Central Community.