- 互联网营销市场经营分析理论与实务
- 任志霞 袁野 杜维主编
- 1038字
- 2025-02-23 04:28:49
2.4 案例
统计大区销售数量和总价、城市销售数量和总价;通过柱状图和饼图在窗体中完成展示,点击大区板块,对应城市数据也同步展示。
具体操作步骤:
Step1:右键点击根目录,新建目录。
Step2:右键点击重命名目录名称——BQ教学。
以此类推,按图2-14所示,建立分类目录。

图2-14 新建分类目录
1.信息域
选中信息域文件夹,右键新建【信息域】。
2.数据准备
本案例只使用到关系数据源中Northwind下的数据。
(1)选中信息域【练习】,右键选择【新建类】,修改名称。
(2)增加【订单统计】分类到关系数据源中,选择需要的表,点击左键不放,拖拽到右边红框区域。如图2-15所示:

图2-15 新建类“订单统计”
(3)选中表中字段City,拖拽到类【订单统计】上。
选中不同表的字段,建立关联关系:左键选中Orders表中CustomerID,拖拽到Customers表中,在CustomersID上,完成连接。如图2-16所示:

图2-16 新建表连接关系
通过双击字段,在弹出的窗口修改名称,以此类推,选择需要的数据信息。
对于新建类,双击进行如下表达式设置:更名为【总价】,选择数据类型——【数值】,如图2-17所示,点击保存。

图2-17 新建数据对象“总价”
3.智能查询
(1)新建查询,如图2-18所示:

图2-18 新建智能查询
(2)选择基于智能查询的构造器。
①选中智能查询—— 【大区求和统计】,保持在设计视图下。如图2-19所示:

图2-19 “大区求和统计”设计视图
②将信息域中的字段,拖拽到查询对象区域,右键,更名。
③对于数量和总价进行求和设置:右键,求和。如图2-20所示:

图2-20 设置“数量”求和
(3)设置智能查询“大区联动到城市”
①选中大区联动到城市,如同【大区统计求和】,在信息域中拖选查询对象。如图2-21所示:

图2-21 “大区联动到城市”设计视图
②选中大区联动到城市,在查询条件区域,拖拽【大区求和统计】中“【大区】=”,右击添加新建参数【大区】,如图2-22所示,点击保存。

图2-22 新建参数“大区”
4.窗体设计
(1)新建窗体,如图2-23所示:

图2-23 新建窗体
(2)制作标题栏。
选择富格式标签,如图2-24所示:

图2-24 制作标题栏
选中编辑区域中的【大区求和统计】,编辑右边属性区的标题等属性。如图2-25所示:

图2-25 设置属性
(3)设计饼形图
选择图形的属性为饼图,也可以选择柱形图,即更换属性ChartType。如图2-26所示:

图2-26 更换属性
拖放【大区求和统计】查询对象,作为数据集。如图2-27所示:

图2-27 施放查询对象
该数据集属性如图2-28所示:

图2-28 数据集属性
选中饼图区域,右键点击【属性页】,通过下拉框设置。如图2-29所示:

图2-29 设置属性
注:此饼图通过Bind Dataset连接数据集;其中大区联动城市,需要如图设置Link To。
以此类推,完成【大区联动到城市】的数据集拖拽和属性设置。