Xceed Chart for WinForms v4.4 Documentation
ChartGridControl Overview

Welcome to Xceed Chart for WinForms v4.4 > Installation Instructions > Integrating into Windows Forms > ChartGridControl Overview

The Xceed.Chart.dll assembly contains a built-in grid component that can seamlessly integrate into Xceed Chart for WinForms. The ChartGridControl class is inherited from the standard .NET DataGrid class and inherits all its functionality.

About ChartGridControl

ChartGridControl is data-aware, which means that it will intelligently display the data series with the appropriate DataGridComboBoxColumnStyle editor. For example, if you want to create a date-time chart, which displays the standard date-time picker for date-time editing, you simply need to set the Format property of the ValueFormatting object (accessible via the ValueFormatting property) of the XValues data series of the series you wish modify to Date:

VB.NET  
lineseries.XValues.ValueFormatting.Format = ValueFormat.Date

C#  
lineseries.XValues.ValueFormatting.Format = ValueFormat.Date;

Data series of type FillEffect are edited with DataGridFillEffectColumnStyle, which embeds the standard Fill Effect editor. 

Data series of type LineProperties are edited with DataGridLinePropertiesColumnStyle, which embeds the standard Line Properties editor. 

Data series of type CursorType are edited with DataGridComboBoxColumnStyle, which displays a combo box with the available cursor types. 

Inserting the Grid into the Form

If the Xceed.Chart.dll is referenced by your Windows Forms application, ChartGridControl is represented by the following icon in the Toolbox: 

 

Drag and drop it onto the form.

Visually Configure the Grid

Right click on the grid and select Properties. The Properties Window displays the properties of the toolbar. In the upper left corner is located the Categories View button: click on it. The exposed properties of the ChartGridControl control appear last in the "Xceed ChartGrid" category.  

figure 1 - Properties of ChartGridControl. 

If you have already inserted a ChartControl (or several chart controls) into the form, you can visually bind the grid to the chart by selecting the chart control you want to manipulate with this instance of the grid from the ChartControl combo. 

The grid has a built-in toolbar control that facilitates the most common user operations. Its visibility can easily be controlled by the ToolbarVisible property.

Programmatically Configure the Grid

You can achieve the same results programmatically. The default name of the first newly created grid is ChartGridControl1, which is what we will use in the following example code:

VB.NET  

' bind to a chart control
chartGridControl1.ChartControl = chartControl1
C#  

// bind to a chart control
chartGridControl1.ChartControl = chartControl1;

You can also easily control which of the grid toolbar buttons are available to the user:

VB.NET  

' show only the update from grid and update chart buttons
chartGridControl1.ChartGridButtonsMask = ChartGridButtonsMask.UpdateSeriesFromGrid Or ChartGridButtonsMask.UpdateGridFromSeries
C#  

// show only the update from grid and update chart buttons
chartGridControl1.ChartGridButtonsMask = ChartGridButtonsMask.UpdateSeriesFromGrid | ChartGridButtonsMask.UpdateGridFromSeries;

If you change the chart control you must also explicitly notify the grid component of the change by invoking its UpdateFromChart method:

VB.NET  
chartGridControl1.UpdateFromChart()

C#  
chartGridControl1.UpdateFromChart();

Related Examples

Windows Forms: Visual Interface Components\Chart Data Grid
Windows Forms: Visual Interface Components\Customized Chart DataGrid

See Also

ChartGridControl