如何将饼图添加到“访问"报告中 [英] How to add a pie chart to my Access report
问题描述
我有一个表格,其中每个"AREA"均显示"DONE"和"REMAIN",如下所示:
I have a table that shows "DONE" and "REMAIN" for each "AREA" like below:
AREA DONE REMAIN TOTAL
AREA1 100 200 300
AREA2 200 300 500
AREA3 200 700 900
现在,我想制作一个报告,使用饼图在每个区域中显示"DONE"和"REMAIN",现在我有问题如何对图形执行此工作,图表的行源"应该如何控制.该表上需要什么查询?
Now I like to make a report that shows "DONE" and "REMAIN" in each AREA with pie chart, now I have problem how I have to do this job for the graph, how should be "row source" of chart control. What query needs on this table?
推荐答案
(我假设您的表名为[AREAS].)
这里的技巧是创建一个名为[AreaDataForPieChart]的已保存UNION查询...
The trick here is to create a saved UNION query named [AreaDataForPieChart]...
SELECT "DONE" AS PieCategory, [DONE] AS PieValue, [AREA] FROM [AREAS]
UNION ALL
SELECT "REMAIN" AS PieCategory, [REMAIN] AS PieValue, [AREA] FROM [AREAS]
...返回...
PieCategory PieValue AREA
----------- -------- -----
DONE 100 AREA1
DONE 200 AREA2
DONE 200 AREA3
REMAIN 200 AREA1
REMAIN 300 AREA2
REMAIN 700 AREA3
...并在此基础上创建饼图.
...and base the pie chart on that.
首先基于[AREAS]表创建报告,然后在文本框中显示[AREA]:
Start by creating a Report based on the [AREAS] table, and display [AREA] in a text box:
现在将Chart控件添加到报表的Detail区域.出现提示时,选择我们在上面创建的保存的查询
Now add a Chart control to the Detail band of the report. When prompted, choose the saved query we created above
选择[PieCategory]和[PieValue]作为图表的列
Choose [PieCategory] and [PieValue] as the columns for the chart
选择饼图"作为图表类型
Choose "Pie Chart" as the chart type
由于查询中列的顺序,默认数据布局将正常工作
The default data layout will work fine because of the order of the columns in our query
告诉报告使用[AREA]字段将图表链接到主报告
Tell the report to link the chart to the main report by using the [AREA] fields
给图表一个有意义的标题,然后单击完成"按钮.
Give the chart a meaningful title, then click the "Finish" button.
现在预览报告.它应该看起来像这样:
Now preview the report. It should look something like this:
这篇关于如何将饼图添加到“访问"报告中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!