Back to Devexpress

How to: Invoke the Chart Designer at Runtime

windowsforms-114128-controls-and-libraries-chart-control-examples-end-user-interaction-how-to-invoke-the-chart-designer-at-runtime.md

latest2.0 KB
Original Source

How to: Invoke the Chart Designer at Runtime

  • Nov 13, 2018

To show the Chart Designer to end-users, create an instance of the ChartDesigner class using the constructor that receives an ChartControl object as a parameter. Then, call the ChartDesigner.ShowDialog method.

csharp
using DevExpress.XtraCharts.Designer;
using System.Windows.Forms;

namespace ChartDesignerRuntime {
    public partial class Form1 : DevExpress.XtraBars.Ribbon.RibbonForm {
        public Form1() {
            InitializeComponent();
            // This line of code is generated by Data Source Configuration Wizard
            productsTableAdapter1.Fill(nwindDataSet1.Products);
        }

        private void btnRunDesigner_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) {
            ChartDesigner designer = new ChartDesigner(chartControl1);
            designer.ShowDialog();
        }
    }
}
vb
Imports DevExpress.XtraCharts.Designer
Imports System.Windows.Forms

Namespace ChartDesignerRuntime
    Partial Public Class Form1
        Inherits DevExpress.XtraBars.Ribbon.RibbonForm

        Public Sub New()
            InitializeComponent()
            ' This line of code is generated by Data Source Configuration Wizard
            productsTableAdapter1.Fill(nwindDataSet1.Products)
        End Sub

        Private Sub btnRunDesigner_ItemClick(ByVal sender As Object, ByVal e As DevExpress.XtraBars.ItemClickEventArgs) Handles btnRunDesigner.ItemClick
            Dim designer As New ChartDesigner(chartControl1)
            designer.ShowDialog()
        End Sub
    End Class
End Namespace