Windows forms: Visual Interface Components\Chart Data Grid
Windows forms: Visual Interface Components\Customized Chart DataGrid
The data series edited by the grid can be controlled in two ways:
Use the IncludedSeries and ExcludedSeries properties of the underlying NDataSeriesGrid . The following example will display only the Values and Labels data series of a line series.
C# |
Copy Code
|
---|---|
nChartGridControl1.DataSeriesGrid.IncludedSeries = DataSeriesMask.Values | DataSeriesMask.Labels; nChartGridControl1.DataSeriesGrid.ExcludedSeries = DataSeriesMask.None; |
Visual Basic |
Copy Code
|
---|---|
nChartGridControl1.DataSeriesGrid.IncludedSeries = DataSeriesMask.Values Or DataSeriesMask.Labels
nChartGridControl1.DataSeriesGrid.ExcludedSeries = DataSeriesMask.None
|
For more information regarding data series filtering please refer to the Basic Series Functionality topic.
Override the NDataSeriesGrid class. The following code examples demonstrates this technique:
C# |
Copy Code
|
---|---|
... // override the NDataSeriesGrid public class MyDataGrid : NDataSeriesGrid { public MyDataGrid() { } // override the GetDataSeries method and return only the series you want to edit in // the order you want to edit them public override NDataSeriesCollection GetDataSeries(NSeriesBase seriesBase) { // for this example assume that the series is derived from NSeries NSeries series = (NSeries)seriesBase; NDataSeriesCollection col = new NDataSeriesCollection(); // add fill styles, values, labels - reorder (if needed) must be made here col.Add(series.FillStyles); col.Add(series.Values); col.Add(series.Labels); // !IMPORTANT - this method must return an aligned collection so force align if needed col.Align(); return col; } } ... // define a member to keep your class instance public MyDataGrid myGrid; ... // handle form load event private void Form1_Load(object sender, System.EventArgs e) { // create your datagrid derivate myGrid = new MyDataGrid(); // replace the data grid used by the NChartGridControl nChartGridControl1.DataSeriesGrid = myGrid; // bind to the chart control nChartGridControl1.ChartControl = chartControl; } |
Visual Basic |
Copy Code
|
---|---|
... ' override the NDataSeriesGrid Public Class MyDataGrid Inherits NDataSeriesGrid Public Sub New() End Sub ' override the GetDataSeries method and return only the series you want to edit in ' the order you want to edit them Public Overrides Function GetDataSeries(ByVal seriesBase As NSeriesBase) As NDataSeriesCollection ' for this example assume that the series is derived from NSeries Dim series As NSeries = CType(seriesBase, NSeries) Dim col As NDataSeriesCollection = New NDataSeriesCollection() ' add fill styles, values, labels - reorder (if needed) must be made here col.Add(series.FillStyles) col.Add(series.Values) col.Add(series.Labels) ' !IMPORTANT - this method must return an aligned collection so force aling if needed col.Align() Return col End Function End Class ... |