这个示例展示了在运行时刻如何显示预填充数据源的 图表向导。 对于那些主要由最终用户来配置图表的应用程序而言,这是很有用的。
要在运行时刻运行图表向导,则应该使用 ChartWizard 对象的 ChartWizard.ShowDialog 方法。 下列代码演示了如何创建图表对象,把它绑定到数据源,然后通过向导让最终用户调整图表的设置,并显示含有图表的一个窗体。
C# | ![]() |
---|---|
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(); |
Visual Basic | ![]() |
---|---|
Imports System.Windows.Forms Imports DevExpress.XtraCharts Imports DevExpress.XtraCharts.Wizard ' ... ' Create a chart Dim chart As ChartControl = 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 Dim wiz As ChartWizard = New ChartWizard(chart) ' Invoke the chart's wizard. wiz.ShowDialog ' Create a form, add the chart to it, and display the form. Dim form As Form = New Form form.Controls.Add(chart) form.Show |