Nevron .NET Vision Documentation
Filtering the data series displayed by the grid

The data series edited by the grid can be controlled in two ways:

For more information regarding data series filtering please refer to the Basic Series Functionality topic.

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
...
Related Examples
Windows forms: Visual Interface Components\Chart Data Grid
Windows forms: Visual Interface Components\Customized Chart DataGrid
See Also

 

 


©2017. Nevron Software LLC.

Send Feedback