SQL Server Reporting Services 2005 - 如何隐藏图表的图例标签?

时间:2022-04-22 08:18:32

I am reporting on data that lets say has 10 columns. Now some of my clients have data in all 10 of the columns whereas some may only use 7 or 5... you get the idea. Of course I dont want to have to build a new rdl for each possibiliy. Well in the tabular report I can hide the columns fine if no data exists by using the IsMissing property.

我正在报告数据,据说有10列。现在我的一些客户在所有10个列中都有数据,而有些可能只使用7或5 ......你明白了。当然,我不想为每个可能性建立一个新的rdl。在表格报告中,如果使用IsMissing属性,如果不存在数据,我可以隐藏列。

Well in the charts, let's say a bar graph, if there is no data for a column it will not show a bar on the graph (which is great) but all of the potential columns still show up in the series legend.

在图表中,让我们说一个条形图,如果没有列的数据,它将不会在图表上显示条形图(这很棒),但所有潜在的列仍然显示在系列图例中。

I've read that 2008 gives you that level of chart customization, but 2005 does not. Any other ideas?

我读过2008年给你的图表定制水平,但2005年没有。还有其他想法吗?

2 个解决方案

#1


I think I actually answered my own question (well, it will work for my scenario). I used the UNPIVOT function available in SQL Server 2005 to put the column data into rows. This gives me a dataset of two columns (Field and Result) with multiple rows now. Now in the SSRS chart, I just drop the Result into the data and the Field into the series and this works out great.

我想我实际上回答了我自己的问题(好吧,它适用于我的场景)。我使用SQL Server 2005中提供的UNPIVOT函数将列数据放入行中。这给了我一个包含多行的两列(字段和结果)的数据集。现在在SSRS图表中,我只是将结果放入数据中,将Field放入系列中,这样做效果很好。

#2


I'm using 2005, but I think for the bar chart that you might be able to do something like this.

我正在使用2005年,但我想在条形图中你可能会做这样的事情。

Chart properties -> Data Tab -> Series Groups (edit) -> Filters -> Add the appropriate filter to remove series that you don't care about.

图表属性 - >数据选项卡 - >系列组(编辑) - >过滤器 - >添加适当的过滤器以删除您不关心的系列。

#1


I think I actually answered my own question (well, it will work for my scenario). I used the UNPIVOT function available in SQL Server 2005 to put the column data into rows. This gives me a dataset of two columns (Field and Result) with multiple rows now. Now in the SSRS chart, I just drop the Result into the data and the Field into the series and this works out great.

我想我实际上回答了我自己的问题(好吧,它适用于我的场景)。我使用SQL Server 2005中提供的UNPIVOT函数将列数据放入行中。这给了我一个包含多行的两列(字段和结果)的数据集。现在在SSRS图表中,我只是将结果放入数据中,将Field放入系列中,这样做效果很好。

#2


I'm using 2005, but I think for the bar chart that you might be able to do something like this.

我正在使用2005年,但我想在条形图中你可能会做这样的事情。

Chart properties -> Data Tab -> Series Groups (edit) -> Filters -> Add the appropriate filter to remove series that you don't care about.

图表属性 - >数据选项卡 - >系列组(编辑) - >过滤器 - >添加适当的过滤器以删除您不关心的系列。