1

我是新手。有没有办法在一个 html 页面上显示多个标准报告?我为每个图表创建了发布淹没组件,并将这些图表显示在带有 html 表格单元格的 div 元素中。我希望能够将这些图表显示为集会之外的一页。图表单独工作,但是当我将它们组合成一个 html 页面时,只有 1 个工作。

允许用户输入一个版本,并且该版本的 objectid 被传递给图表显示函数。请参阅下面的代码片段:

function releaseSelected2(dropdown,eventArgs) {
     var selectedItem=eventArgs.item;  
     var selectedValue = eventArgs.value;
     var releaseObjids2 =  new Array();
     releaseObjids2[1]=selectedItem.ObjectID;         
     displayChart2(releaseObjids2[1]);
} //end event listener for chart1
var ddown2=document.getElementById("ddown2");
var config2 = { label: "Select a release   "   };
var releaseDropdown = new rally.sdk.ui.ReleaseDropdown(config2,rallyDataSource);
releaseDropdown.display(ddown2,releaseSelected2);

 function releaseSelected(dropdown,eventArgs) {
 var selectedItem=eventArgs.item;
 var selectedValue = eventArgs.value;
 var releaseObjids =  new Array();
 releaseObjids[1]=selectedItem.ObjectID;          
 displayChart1(releaseObjids[1]);
}
var ddown1=document.getElementById("ddown1");
var config = { label: "Select a release " };
var releaseDropdown = new rally.sdk.ui.ReleaseDropdown(config,rallyDataSource);
releaseDropdown.display(ddown1,releaseSelected);

function displayChart1(release) { 
  var config = {
  report: rally.sdk.ui.StandardReport.ReleaseDefectTrend,
  title: 'Blacklight: Release defect trend',
  subtitle: 'subtitle placeholder',
   width : 550,
   height: 500,
   releases: release
};

 var report = new rally.sdk.ui.StandardReport(config);
 var div1=document.getElementById("div1");
 report.display(div1);  

  }
 function displayChart2(release2) {
var config2 = {
report: rally.sdk.ui.StandardReport.ReleaseBurnup,
 title: 'Blacklight: Release burnup',
 subtitle: 'subtitle placeholder',
 width : 550,
 height:500,
 release: release2
};                              
var report2 = new rally.sdk.ui.StandardReport(config2);
var div2=document.getElementById("div2");
report2.display(div2); 
}

//html
.
.
<table border="1">
<tr>
   <th>  </th>
   <th>  </th>
 </tr>
<tr>
<th id="ddown1">  </th>
<th id="ddown2"> </th>
</tr>
<tr>
 <td>
   <div id="div1"></div>
 </td>
<td> 
  <div id="div2"></div>
 </td>
</tr>

</table>
.
.
.
4

1 回答 1

0

我重新排列了您给我的代码片段,现在我可以查看这两个图表。您的代码似乎对我来说通常工作得很好,所以我想知道问题是否与您最初拥有的表格布局有关......它对您有用吗?

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<!-- Copyright (c) 2011  Rally Software Development Corp.  All rights reserved -->
<html>
<head>
<script type="text/javascript" src="/apps/1.32/sdk.js?debug=true"></script>

<script type="text/javascript">
    function onLoad() {
        var rallyDataSource = new  rally.sdk.data.RallyDataSource("__WORKSPACE_OID__",
             "__PROJECT_OID__",
             "__PROJECT_SCOPING_UP__",
             "__PROJECT_SCOPING_DOWN__");
        var ddown1=document.getElementById("ddown1");
        var config = { label: "Select a release " };
        var releaseDropdown = new rally.sdk.ui.ReleaseDropdown(config,rallyDataSource);
        releaseDropdown.display(ddown1,releaseSelected);

        var ddown2=document.getElementById("ddown2");
        var config2 = { label: "Select a release   "   };
        var releaseDropdown = new                 rally.sdk.ui.ReleaseDropdown(config2,rallyDataSource);
        releaseDropdown.display(ddown2,releaseSelected2);
    }

    function releaseSelected2(dropdown,eventArgs) {
        var selectedItem=eventArgs.item;  
        var selectedValue = eventArgs.value;
        var releaseObjids2 =  new Array();
        releaseObjids2[1]=selectedItem.ObjectID;         
        displayChart2(releaseObjids2[1]);
    } //end event listener for chart1

    function releaseSelected(dropdown,eventArgs) {
        var selectedItem=eventArgs.item;
        var selectedValue = eventArgs.value;
        var releaseObjids =  new Array();
        releaseObjids[1]=selectedItem.ObjectID;          
        displayChart1(releaseObjids[1]);
    }

    function displayChart1(release) { 
        var config = {
            report: rally.sdk.ui.StandardReport.ReleaseDefectTrend,
            title: 'Blacklight: Release defect trend',
            subtitle: 'subtitle placeholder',
            width : 550,
            height: 500,
            releases: release
        };

        var report = new rally.sdk.ui.StandardReport(config);
        var div1=document.getElementById("div1");
        report.display(div1);  
   }

   function displayChart2(release2) {
       var config2 = {
           report: rally.sdk.ui.StandardReport.ReleaseBurnup,
           title: 'Blacklight: Release burnup',
           subtitle: 'subtitle placeholder',
           width : 550,
           height:500,
           releases: release2
       };                              

       var report2 = new rally.sdk.ui.StandardReport(config2);
       var div2=document.getElementById("div2");
       report2.display(div2); 
   }

    rally.addOnLoad(onLoad);
</script>
</head>
<body>
<table border="1">
<tr>
 <td align="center"><div id="ddown1"></div></td>
 <td align="center"><div id="ddown2"></div></td>
</tr>
<tr>
 <td><div id="div1"></div></td>
 <td><div id="div2"></div></td>
</tr>
</table>
</body>

于 2012-08-29T13:43:24.413 回答