Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Changing Chart MinDataAxisValue and MaxDataAccessValue at Runtime using RAS

Greetings Fellow .Net Coders,

I have been workin on a solution for several days now in which it is necessary to over-ride the automatic Min and Max data axis Values (Scale) at runtime for a chart in a CR2008 report. Since CRAXDRT.DLL is no longer supported by CR2008, I need to find out how to control these values at runtime. The legacy method to accomplish what I need to do is as follows:

Dim oReport As New CrystalReport1

Private Sub Form_Load()

' Declare an GraphObject object.

Dim oGraph As CRAXDRT.GraphObject

' Declare a generic Object.

Dim oObject As Object

' Declare a Section object.

Dim oSection As CRAXDRT.Section

' This variable is set to true once the graph object is found.

Dim bGraph As Boolean

bGraph = False

' Search for all the report objects in each section.

For Each oSection In oReport.Sections

For Each oObject In oSection.ReportObjects

' Find the first graph object.

If oObject.Kind = crGraphObject Then

' Get the graph object and exit the loop.

Set oGraph = oObject

bGraph = True

Exit For

End If

Next oObject

If bGraph Then Exit For

Next oSection

' Format the graph object.

With oGraph

.AutoRangeData2Axis = False

.Data2AxisDivisionMethod = crManualDivision

.MaxData2AxisValue = 999999

.MaxDataAxisValue = 999999

.MinData2AxisValue = -999999

.MinDataAxisValue = -999999

End With

' Set the report source of the viewer and view the report.

CRViewer1.ReportSource = oReport

CRViewer1.ViewReport

In yesterdays research I found it is necessary to now use in proc RAS to reference and control the formatting of a chart at runtime. I got as far as the code below shows:

Private Sub CrystalReportViewer1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CrystalReportViewer1.Load

CRViewer = Me.CrystalReportViewer1

Dim path As String = "C:\DocumentPath\rptInsideDiameter.rpt"

CreateReport(path)

End Sub

Sub CreateReport(ByVal path As String)

m_crNetDoc = New ReportDocument

m_crNetDoc.Load(path)

m_RasDoc = m_crNetDoc.ReportClientDocument

CRViewer.ReportSource = m_RasDoc.ReportSource

End Sub

Can anyone help direct me to the reference/examples/tutorial content to help me achieve the control of chart formatting at runtime using in-proc RAS?

Thanks in Advance

Jeremy May

Resource Computer Solutions

Not what you were looking for? View more on this topic or Ask a question