Skip to Content
0
Former Member
Mar 03, 2009 at 09:01 AM

Runtime scaling of Graphs (ChartObject)

171 Views

Hello,

i'm currently evaluating the available Crystal for .NET solutions for our company.

The preparation of data that is to be consumed by the reportviewer, is handled mainly in our application. Therefore, all our reports are called from within the application using the SDK for .NET.

Existing reports were converted from a legacy VB6 (.dsr) / Crystal Reports Enterprise 10 solution.

So far, we have managed to maintain all existing requirements, but an important feature seems to be missing. I can't figure out why it was left out, or what is needed to get it working. I was hoping you could help me with this.

What we need is scaling the report's graphs at runtime. E.g. Provide an inputbox somewhere along the reportviewer screen, so that the user may input a minimum and maximum value for Y-axis.

The values would be used to adjust the graph scaling and refresh the report. In CR10, this worked like a charm.

Programmatically this could be perfomed along the lines of:

'This procedure sets the range of the graph, when the autorange-checkbox is checked, the graph is shown with autoscale on, otherwise the scale is set with the user-defined values
Public Sub SetRange(Optional ByVal pstrMinVal As String = "", Optional ByVal pstrMaxVal As String = "",  Optional ByVal pblChecked As Boolean = False)
   Dim a As Long
   If pblChecked = False Then 'user filled textboxes, so set user-defined values
      GraphDowntime.AutoRangeDataAxis = False
      GraphDowntime.MaxDataAxisValue = pstrMaxVal
      GraphDowntime.MinDataAxisValue = pstrMinVal
   Else 'AutoRange checkbox is checked, so return to autorange state
      GraphDowntime.AutoRangeDataAxis = True
   End If

End Sub

I learned that the graph instance is now referred to as a GraphObject, so it can be found as

CrystalDecisions.CrystalReports.Engine.ChartObject

by enumerating through the

ReportDefinition.Sections

or

ReportDefinition.ReportObjects

.

However, the ChartObject won't let me set these properties.

Q: What is the preferred approach for this scenario?