简体   繁体   English

如何在Crystal报表中更改图表类型

[英]How to change chart type in crystal reports

I am using visual studio 2008 and I want to change the Chart type upon activating run time in crystal reports. 我正在使用Visual Studio 2008,并且希望在激活水晶报表中的运行时时更改图表类型。 For example, we have various chart type options in Bar Chart, line Chart, Area, Pie etc. 例如,我们在条形图,折线图,面积,饼图等中有各种图表类型选项。

Appreciate if anyone could tell me the solution. 谢谢有人能告诉我解决方案。

I'm not sure you can change that on run time. 我不确定您可以在运行时更改它。 What you can do is create the charts in different sections each and then suppress them and only show the chart based on a parameter or something else. 您可以做的是分别在不同的部分中创建图表,然后隐藏它们并仅基于参数或其他内容显示图表。

Dim oldChart As CrystalDecisions.ReportAppServer.ReportDefModel.ChartObject
    Dim newChart As CrystalDecisions.ReportAppServer.ReportDefModel.ChartObject
    oldChart = CType(rcd.ReportDefController.ReportObjectController.GetReportObjectsByKind(CrystalDecisions.ReportAppServer.ReportDefModel.CrReportObjectKindEnum.crReportObjectKindChart)(0), CrystalDecisions.ReportAppServer.ReportDefModel.ChartObject)
    newChart = CType(oldChart.Clone(True), CrystalDecisions.ReportAppServer.ReportDefModel.ChartObject)
    newChart.ChartStyle.TextOptions.Title = "My New Chart Title"
    newChart.ChartStyle.TextOptions.DataTitle = "My New Data Title"
    newChart.ChartStyle.TextOptions.GroupTitle = "My New Group Title"
    newChart.ChartStyle.TextOptions.Subtitle = "My New subtitle"
    newChart.ChartStyle.Type = **CrystalDecisions.ReportAppServer.ReportDefModel.CrChartStyleTypeEnum.crChartStyleTypePie**

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM