如何制作Drill-Down向下钻取 表,为数据分析提供多种交互能力

分组 告是数据分析所必需的。但是当有大量数据并且不需要全部显示时,带有分组的常规 告变得麻烦且多余。您希望为此类案例找到通用解决方案吗?这里正好有一个。

分组 告是数据分析所必需的。但是当有大量数据并且不需要全部显示时,带有分组的常规 告变得麻烦且多余。您希望为此类案例找到通用解决方案吗里正好有一个。

带有下拉列表的 告本质上是一个包含分组数据的 告,但能够通过鼠标单击隐藏或显示组中的数据。它不仅非常方便,而且美观。毕竟, 告成为一个交互式对象。当用户可以参与信息显示时,用户会很高兴。

考虑如何制作此类 告的示例。首先,与Master-Detail主从 表一样(点击这里查看如何制作Master-Detail主从 表>>),我们需要一个包含链接表的数据源。假设我们有两个表:客户和订单。

如何制作Drill-Down向下钻取 表,为数据分析提供多种交互能力

一个客户可以做很多订单——一对多的关系。我们加上吧。单击Actions按钮,然后从下拉列表中选择New Relation …

如何制作Drill-Down向下钻取 表,为数据分析提供多种交互能力

父表是主表,然后选择“customer”。子表分别是“orders”。在“customer”中有一个主键CustNo,在列表中选择它。在“orders”中有一个外键CustNo,也选择它。

结果,我们获得了连接:

如何制作Drill-Down向下钻取 表,为数据分析提供多种交互能力

现在让我们开始创建 告模板。添加一个频段“group header”。在它上面我们将放置链接中的字段:“orders.customer.Company”、“orders.customer.Addr1”、“orders.customer.Phone”、“orders.customer.Contact”。

除了这些字段之外,我们还要为此频段添加一个复选框控件。在CheckedSymbol属性中,选择Plus,然后选择UncheckedSymbol – Minus。

添加“orders”表中的字段:OrderNo、SaleDate、PaymentMethod、AmountPaid到“Data”频段。另外,为数据和字段标题添加标题区:

如何制作Drill-Down向下钻取 表,为数据分析提供多种交互能力

双击组标题“Headline”。选择要分组的字段:

如何制作Drill-Down向下钻取 表,为数据分析提供多种交互能力

现在选择我们之前添加的复选框。给它一个Hyperlink属性:

如何制作Drill-Down向下钻取 表,为数据分析提供多种交互能力

选择“Group Header”区域并为其创建BeforePrint事件处理程序:

如何制作Drill-Down向下钻取 表,为数据分析提供多种交互能力
 private void GroupHeader1_BeforePrint(object sender, EventArgs e) { string groupName = (String)Report.GetColumnValue("orders.customer.Company"); // get the group name bool groupVisible = expandedGroups.Contains(groupName); // Check group visibility DataHeader1.Visible = groupVisible; Data1.Visible = groupVisible;// Set the visibility of data in accordance with the visibility of the group GroupFooter1.Visible = groupVisible;// Set the visibility of the basement of the group in accordance with the visibility of the group CheckBox1.Checked = !groupVisible;// Set the state of the flag depending on the visibility of the group }

还要向类添加扩展组列表:

private List expandedGroups = new List();

让我们回到我们的复选框。为此,创建一个Click事件处理程序:

private void CheckBox1_Click(object sender, EventArgs e){string groupName = (sender as CheckBoxObject).Hyperlink.Value; // We get the name of the group from the hyperlinkif (expandedGroups.Contains(groupName)) // If the list of visible groups contains the selected groupexpandedGroups.Remove(groupName); // Then remove the selected from the list of visible groups.elseexpandedGroups.Add(groupName); // Otherwise add the group to the list of visibleReport.Refresh(); // Update Report}

以预览模式运行 告:

如何制作Drill-Down向下钻取 表,为数据分析提供多种交互能力

现在点击任何加 :

如何制作Drill-Down向下钻取 表,为数据分析提供多种交互能力

当您单击减 时会分组折叠。大神们都表示同意,这样确实很方便。

产品介绍 | 下载试用 | 优惠活动 | 在线客服

标签:

声明:本站部分文章及图片源自用户投稿,如本站任何资料有侵权请您尽早请联系jinwei@zod.com.cn进行处理,非常感谢!

上一篇 2019年8月15日
下一篇 2019年8月15日

相关推荐

发表回复

登录后才能评论