Glossary Item Box
ActiveReports for .NET 2.0 allows you to drop a third party control as a custom control onto an ActiveReport.
This walkthrough illustrates how to use ChartFX as a custom control with ActiveReports.
This walkthrough is split up into the following activities:
To complete the walkthrough, you must have ChartFX installed.
When you have completed this walkthrough, you will have a report with a chart that looks similar to the following.
To add an ActiveReport to your project
To add the ChartFX control to rptChart
To add a label to the PageHeader
To write the code in Visual Basic
To write the code in C#
The following example shows what the code for the method looks like.
' Visual Basic
Private Sub Detail_Format(ByVal sender As Object, ByVal e As System.EventArgs) Handles _ Detail.Format Dim r As New System.Random() Dim ChartControl1 As SoftwareFX.ChartFX.Chart 'Cast customControl as ChartFX chart ChartControl1 = CType(Me.CustomControl1.Control, SoftwareFX.ChartFX.Chart) Dim i As Integer Dim j As Integer 'Open the communication channel ChartControl1.OpenData(SoftwareFX.ChartFX.COD.Values, 3, 3) For i = 0 To 2 For j = 0 To 2 'Assign the values to the series selected ChartControl1.Value(i, j) = r.NextDouble() * 100 Next j Next i 'Close the communication channel ChartControl1.CloseData(SoftwareFX.ChartFX.COD.Values) End Sub
//C#
private void Detail_Format(object sender, System.EventArgs eArgs) { System.Random r = new System.Random(); Chart ChartControl1 = new Chart(); //Cast customControl as ChartFX chart ChartControl1 = ((SoftwareFX.ChartFX.Chart)this.CustomControl1.Control); //Open the communication channel ChartControl1.OpenData(SoftwareFX.ChartFX.COD.Values, 3, 3); for (int i=0;i<3;i++) { for (int j=0;j<3;j++) { //Assign the values to the series selected ChartControl1.Value[i, j] = r.NextDouble() * 100; } } //Close the communication channel ChartControl1.CloseData(SoftwareFX.ChartFX.COD.Values); }
Copyright © 2004-2005 Data Dynamics, Ltd. All rights reserved.