How to: Invoke the Chart Wizard at Runtime
- 2 minutes to read
This example demonstrates how to show the Chart Wizard at runtime with a pre-filled data source. This may be useful for those applications when a chart is mostly configured by an end-user.
To run the Chart Wizard at runtime you should use the ChartWizard.ShowDialog method of a ChartWizard object. The following code demonstrates how to create a chart object, bind it to a data source, then let an end-user adjust the chart's settings via the wizard, and show a form with a chart in it.
using System.Windows.Forms; using DevExpress.XtraCharts; using DevExpress.XtraCharts.Wizard; // ... // Create a chart. ChartControl chart = new ChartControl(); // Set its data source. // You can set any other specific options for the chart here. chart.DataSource = dataSet11; // Create a ChartWizard for a new ChartControl ChartWizard wiz = new ChartWizard(chart); // Invoke the chart's wizard. wiz.ShowDialog(); // Create a form, add the chart to it, and display the form. Form form = new Form(); form.Controls.Add(chart); form.Show();