ActiveReports 18 .NET Edition
Developers / Work with Reports using Code / Section Report / Work with Code-based Section Reports / Use Custom Controls on Reports / Create Custom Chart Control
In This Topic
    Create Custom Chart Control
    In This Topic

    This is an internal control that allows using third-party WinForms controls inside a Section report (mainly, a code-based Section report). The main target area of this control is using scripts.

    CustomControl is not supported in:

    Using a CustomControl to Create Chart Control   

    1. In Microsoft Visual Studio 2022 (version 17.0 or above), create a Windows Forms App (.NET Framework) project and in Project > Add New Item.., select ActiveReports 18 Code-Based Report template and click Add.    
    2. Add reference to System.Windows.Forms.DataVisualization.
    3. From the Visual Studio toolbox, drag and drop the Data > Chart item to the design surface.
    4. Add the following code to the code-based report constructor after the InitializeComponent method:
      VB code. Add this code after the InitializeComponent method
      Copy Code
      Dim chart = CType(Me.customControl1.Control, System.Windows.Forms.DataVisualization.Charting.Chart)
      Dim chartArea = New System.Windows.Forms.DataVisualization.Charting.ChartArea("Main")
      chart.ChartAreas.Add(chartArea)
      Dim seriesColumns = New System.Windows.Forms.DataVisualization.Charting.Series("Columns")
      For Each val In New Single() {6, 14, 3, 4, 2, 2, 1, 3}
          seriesColumns.Points.Add(Convert.ToDouble(val))
      Next
      seriesColumns.ChartType = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.Radar
      chart.Series.Add(seriesColumns)
      
      C# code. Add this code after the InitializeComponent method
      Copy Code
      var chart = (System.Windows.Forms.DataVisualization.Charting.Chart)this.customControl1.Control;
      var chartArea = new System.Windows.Forms.DataVisualization.Charting.ChartArea("Main"); 
      
      chart.ChartAreas.Add(chartArea);
      var seriesColumns = new System.Windows.Forms.DataVisualization.Charting.Series("Columns");
      foreach (var val in new float[] { 6, 14, 3, 4, 2, 2, 1, 3 })  
      
          seriesColumns.Points.Add(Convert.ToDouble(val));
      seriesColumns.ChartType = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.Radar;
      chart.Series.Add(seriesColumns);