历史版本2 :JS实现按分类钻取图表 返回文档
编辑时间: 内容长度:图片数:目录数: 修改原因:

目录:

1.描述编辑

在图表的应用需求中,有时候会需要按照图表类型去钻取相应页面,可以利用 JS 代码来辅助完成

2. 实现思路编辑

使用iframe实现当前页钻取,并弹出框方式展示。

var iframe = $("<iframe id='001' name='001' width='100%' height='100%' scrolling='yes' frameborder='0'>") 
// iframe参数的命名及宽高等
if (参数 == '分类1') {    //判断点击到的点,根据所选纬度弹出明细对话框
   iframe.attr("src", "report?viewlet=/详细1.cpt&op=view&参数=" + 参数 + "")
}
..........else
........

var o = {
   title: wd,    //对话框标题(这里取雷达图纬度名作弹出框标题)
   width: 1265,  //宽   统一宽高
   height: 370  //高}
FR.showDialog(o.title, o.width, o.height, iframe, o) //弹出对话框

3. 操作步骤/示例编辑

这里使用雷达图作为实例

编辑→特效→ 添加JavaScript

参数:wd    值:分类名      #取雷达图所点击的点

参数:jd      值:公式$jd    #取参数下拉所选参数

var iframe = $("<iframe id='001' name='001' width='100%' height='100%' 
scrolling='yes' frameborder='0'>") // iframe参数的命名及宽高等
if (wd == '纬度1') {    //判断点击到的点,根据所选纬度弹出明细对话框
iframe.attr("src", "report?viewlet=/test/明细1.cpt&op=view&jd=" + jd + "")
} else if (wd == '纬度2') {    
iframe.attr("src", "report?viewlet=/test/明细2.cpt&op=view&jd=" + jd + "")}
var o = {    title: wd,    //对话框标题(这里取雷达图纬度名作弹出框标题)    
            width: 1265,  //宽   统一宽高    
            height: 370  //高
        }
FR.showDialog(o.title, o.width, o.height, iframe, o) //弹出对话框

或者单独定义每个弹出框的宽高

var url = "";var title = ""var o = ""if(wd=="纬度1")
{    url = "report?viewlet=/test/纬度1详细.cpt&op=view&jd=" + jd + "";    
title = wd;    
o = {          width : 1000,  //对话框宽度      
             height: 400   //对话框高度     }; }
 else if(wd=="纬度2")
{    url = "report?viewlet=/test/纬度2详细.cpt&op=view&jd=" + jd + "";    
title = wd;    
o = {        width : 1265,  //对话框宽度      
                height: 370    //对话框高度      }; }
var iframe = $("<iframe id='inp' name='inp' width='100%' height='100%' scrolling='yes' frameborder='0'>");
// 对话框内iframe参数的命名,默认宽高占比是100%,可向下滚动    
iframe.attr("src", url); // 给iframe添加src属性
//弹出对话框
FR.showDialog(title, o.width, o.height, iframe,o);

4. 效果查看编辑

5.已完成模板(提交附件)编辑