Chart for .NET / Getting Started / Integrating in Windows Forms / NChartGridControl / NChartGridControl Overview

In This Topic
    NChartGridControl Overview
    In This Topic
    The Nevron.Chart.WinForm.dll assembly contains a built-in grid component which can seamlessly integrate with Nevron Chart for .NET. The NChartGridControl is derived from the standard .NET DataGrid class and inherits its functionality.
     About the NChartGridControl

    The NChartGridControl is data aware, which means that it is able to display the data series with the appropriate DataGridColumnStyle editor. For example if you want to create a date time chart, which displays the standard date time picker for editing, you just have to set the value formatter of the respective XValues data series to NDateTimeValueFormatter with DateTimeValueFormat.Date. For example:

    
    
            
    C#
    Copy Code
    lineSeries.XValues.ValueFormatter = new NDateTimeValueFormatter(DateTimeValueFormat.Date);
    
    
    
    
    
            
    Visual Basic
    Copy Code
    lineSeries.XValues.ValueFormatter = New NDateTimeValueFormatter(DateTimeValueFormat.Date)
    
    
    

    Data series of type FillStyle are edited with the NDataGridFillStyleColumnStyle, which embeds the standard fill style editor.

    Data series of type StrokeStyle are edited with the NDataGridStrokeStyleColumnStyle, which embeds the standard stroke style editor.

    Data series of type InteractivityStyle are edited with the NDataGridInteractivityStyleColumnStyle, which embeds the standard interactivity style editor.

    Data series of type MarkerStyle are edited with the NDataGridMarkerStyleColumnStyle, which embeds the standard interactivity style editor.

    Data series of type DataLabelStyle are edited with the NDataGridDataLabelStyleColumnStyle, which embeds the standard interactivity style editor.

     Inserting the grid in the form

    If Nevron.Chart.WinForm.dll is referenced by your Windows Forms application the NChartGridControl must be represented by the following item in the toolbox:

    Drag and drop it in the form.

     Visually configure the grid

    Right click on the grid and select Properties. The Properties Window must display the properties of the grid. In the up left corner is located the Categories View button - click on it. The exposed properties of NChartGridControl control must appear in the "Nevron NChartGrid" category.

    If you have already inserted a NChartControl (or several chart controls) in the form you can 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 which 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 result programmatically. The default name of the first newly created grid is nChartGridControl1 and that is why we will use it in the following example code:

    C#
    Copy Code
    // bind to a chart control
    nChartGridControl1.ChartControl = chartControl;
    
    
    
            
    Visual Basic
    Copy Code
    ' bind to a chart control
    nChartGridControl1.ChartControl = chartControl
    
    
    

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

    
    
            
    C#
    Copy Code
    // show only the update from grid and update chart buttons 
    nChartGridControl1.ChartGridButtonsMask = ChartGridButtonsMask.UpdateSeriesFromGrid | ChartGridButtonsMask.UpdateGridFromSeries;
    
    
    
    
    
            
    Visual Basic
    Copy Code
    ' show only the update from grid and update chart buttons 
    nChartGridControl1.ChartGridButtonsMask = ChartGridButtonsMask.UpdateSeriesFromGrid Or ChartGridButtonsMask.UpdateGridFromSeries
    
     Related Examples

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

    See Also