代码示例:自定义记分卡转换
上次修改时间: 2011年5月31日
适用范围: SharePoint Server 2010
建议将该示例用作您的自定义扩展的模板,因为它演示了使用 PerformancePoint Services 编程的最佳实践。有关支持的扩展类型的详细信息,请参阅使用 PerformancePoint Services 的开发方案。
示例记分卡转换
该示例包含以下记分卡转换:
AddColumnTransform.cs 定义一个 PreQuery 记分卡转换,它以动态方式向列叶级包含关键绩效指标 (KPI) 的记分卡添加列。
FormattingTransform.cs 定义一个 PreRender 记分卡转换,它可更改记分卡的默认字体和配色方案。
NumberScalingTransform.cs 定义一个 PostQuery 记分卡转换,它可对大数字应用 B、M 和 K 缩放。
ShowAnnotationDate.cs 定义一个 PreRender 记分卡转换,它可显示距离上一次修改批注的天数。
安装示例记分卡转换
若要安装示例记分卡转换,必须生成示例程序集、在全局程序集缓存中注册该程序集,然后在 PerformancePoint Services web.config 文件中注册扩展。这些任务要求在应用程序服务器(即运行 PerformancePoint Services 的计算机)上拥有足够的管理权限。
备注
有关如何安装完整示例的说明包含在示例文件中。
安装示例记分卡转换
下载 PerformancePoint Services SDK 参考示例(该链接可能指向英文页面)压缩 (.zip) 文件,它包含记分卡转换组件。
将内容提取到计算机上的文件夹中。
在 Visual Studio 中打开示例。
在"解决方案资源管理器"中,展开 References 文件夹,并还原任何缺少的项目引用。PerformancePoint Services 程序集只安装到全局程序集缓存中。根据您的开发环境,可能需要将这些程序集复制到其他目录。有关从全局程序集缓存复制 PerformancePoint Services 程序集的说明,请参阅 开发方案中使用的 PerformancePoint Services DLL。
该示例包含对以下 PerformancePoint Services 和 SharePoint Server 2010 程序集的引用:
Microsoft.PerformancePoint.Scorecards.Client
Microsoft.PerformancePoint.Scorecards.DataSourceProviders.Standard
Microsoft.PerformancePoint.Scorecards.Server
Microsoft.PerformancePoint.Scorecards.ServerCommon
Microsoft.PerformancePoint.Scorecards.ServerRendering
Microsoft.PerformancePoint.Scorecards.Store
Microsoft.SharePoint
生成示例程序集。
备注
这些说明假定您使用示例中包含的 SDKSamples.snk 文件对程序集进行签名。如果使用其他强名称密钥文件生成程序集的公钥标记,请使用实际密钥替换这些说明中的示例公钥标记 (fa525c8383a44a52)。
在应用程序服务器上,将示例程序集 (Microsoft.PerformancePoint.SDK.Samples.dll) 添加到全局程序集缓存中。有关说明,请参阅How to: Install an Assembly into the Global Assembly Cache。
导航到位于应用程序服务器上默认路径 C:\Program Files\Microsoft Office Servers\14.0\WebServices\PpsMonitoringServer 中的 PerformancePoint Services web.config 文件。
重要说明
最好是在编辑 web.config 文件之前创建其副本。
在诸如记事本之类的文本编辑器中打开 PerformancePoint Services web.config 文件。
若要注册示例记分卡转换,请将以下代码粘贴到 CustomViewTransforms 元素中。
<add key="AddColumn" value="Microsoft.PerformancePoint.SDK.Samples.ScorecardTransforms.PreQuery.AddColumnTransform, Microsoft.PerformancePoint.SDK.Samples, Version=14.0.0.0, Culture=neutral, PublicKeyToken=fa525c8383a44a52"/> <add key="NumberScaling" value="Microsoft.PerformancePoint.SDK.Samples.ScorecardTransforms.PostQuery.NumberScalingTransform, Microsoft.PerformancePoint.SDK.Samples, Version=14.0.0.0, Culture=neutral, PublicKeyToken=fa525c8383a44a52"/> <add key="ShowAnnotationDate" value="Microsoft.PerformancePoint.SDK.Samples.ScorecardTransforms.PreRender.ShowAnnotationDate, Microsoft.PerformancePoint.SDK.Samples, Version=14.0.0.0, Culture=neutral, PublicKeyToken=fa525c8383a44a52"/> <add key="FormattingTransform" value="Microsoft.PerformancePoint.SDK.Samples.ScorecardTransforms.PreRender.FormattingTransform, Microsoft.PerformancePoint.SDK.Samples, Version=14.0.0.0, Culture=neutral, PublicKeyToken=fa525c8383a44a52"/>
保存然后关闭 web.config 文件。
根据您的环境,可能需要重新启动 Internet Information Services (IIS)。
安装示例记分卡转换后,将它们应用到您从 PerformancePoint 仪表板设计器创建和部署的仪表板上的记分卡视图和策略图报表。有关如何使用仪表板设计器的详细信息,请参阅 Office 网站。