Charts with Dynamic Height or Width based on Categories/Data (SQL 2008, RDL)
2009-08-19 22:19
926 查看
You may have been in this situation before - you designed a chart based on a particular dataset and everything looks great. However, later the data volume increases, or new categories dynamically show up in your data source, and there is not enough horizontal/vertical space in the chart to show all the data or categories. Unless, of course, you applied an approach to dynamically increase the height/width of the chart.
There are two new Chart RDL properties in the report designer / report builder property grid to simplify this task in Reporting Services 2008:
DynamicHeight: the height the chart should grow/shrink at runtime
DynamicWidth: the width the chart should grow/shrink at runtime
If the properties are not specified, then the design time sizes will be applied. Both properties can be set to any RDL expression that evaluates to a size string at runtime (e.g. ="3 in"). Btw, note the space in the size string between the numeric part and the size unit.
The attachment of this posting contains a small report that demonstrates this technique. The report is based on the Northwind sample database (database download link). The chart in the report dynamically increases its width based on the number of countries shown in the chart (determined by a report parameter value). To accomplish this, the DynamicWidth property of the chart is set to the following expression:
=(1 + Parameters!TopNCountries.Value / 2) & " in"
In this example, if you choose to show only the top 5 countries, the chart will have a width of 1+5/2 = 3.5 inches. If you select the top 10 countries, the chart has a width of 1+10/2 = 6 inches and therefore more horizontal room to draw additional categories.
from: http://blogs.msdn.com/robertbruckner/archive/2008/10/27/charts-with-dynamic-size-based-on-categories-or-data.aspx
注: RDLC, RDL 中如果有错误,编译会提示有错误,但不会指出哪个项目,哪个文件有错误(VS2008)。
There are two new Chart RDL properties in the report designer / report builder property grid to simplify this task in Reporting Services 2008:
DynamicHeight: the height the chart should grow/shrink at runtime
DynamicWidth: the width the chart should grow/shrink at runtime
If the properties are not specified, then the design time sizes will be applied. Both properties can be set to any RDL expression that evaluates to a size string at runtime (e.g. ="3 in"). Btw, note the space in the size string between the numeric part and the size unit.
The attachment of this posting contains a small report that demonstrates this technique. The report is based on the Northwind sample database (database download link). The chart in the report dynamically increases its width based on the number of countries shown in the chart (determined by a report parameter value). To accomplish this, the DynamicWidth property of the chart is set to the following expression:
=(1 + Parameters!TopNCountries.Value / 2) & " in"
In this example, if you choose to show only the top 5 countries, the chart will have a width of 1+5/2 = 3.5 inches. If you select the top 10 countries, the chart has a width of 1+10/2 = 6 inches and therefore more horizontal room to draw additional categories.
from: http://blogs.msdn.com/robertbruckner/archive/2008/10/27/charts-with-dynamic-size-based-on-categories-or-data.aspx
注: RDLC, RDL 中如果有错误,编译会提示有错误,但不会指出哪个项目,哪个文件有错误(VS2008)。
相关文章推荐
- A Hybrid User and Item-Based Collaborative Filtering with Smoothing on Sparse Data
- [转] --- Error: “A field or property with the name was not found on the selected data source” get only on server
- A Hybrid User and Item-Based Collaborative Filtering with Smoothing on Sparse Data
- opencv bug? cvExtractSurf fails with Non-positive width or height exception (opencv 2.1.0)
- Handling workloads on SQL Server 2008 with Resource Governor
- use a data or computed property based on the prop's value.
- Grab a SQL Image data type with the Connector, ODBC or Microsofts ADO
- 错误:A field or property with the name 'XXX' was not found on the selected data source 解决
- Collation can be based on the Windows Collation or SQL Collation
- CCLabelTTF with fixed width and dynamic height solution
- CTreeCtrl/CListCtrl/CListBox With ToolTip Based On the Item Data
- Export table data sql scrpit on sql server 2008
- spring.data.jpa.query :Cannot use native queries with dynamic sorting and/or pagination in method
- Handling workloads on SQL Server 2008 with Resource Governor
- Dynamically changing the linearlayout width or height on Android
- Get XML tree format based on the tree data in SQL server table
- Steps to install SQL Server 2008 R2 Express Edition or Developer Edition with profiler
- How to deal with "Could not find component on update server. Contact VMware Support or your system administrator." in Vmware.
- System.Data.OracleClient on Windows 2008 x64
- Add Addtional Series with fitlers of Stacked Column Charts or Bar Charts in MS CRM 2011