Hi,
You can intercept the selection changed event of the selector and filter the selected objects dynamically - the following example prevents the user from dragging the first and last bars:
private void Form1_Load(object sender, EventArgs e)
{
NChart chart = nChartControl1.Charts[0];
NBarSeries bar = (NBarSeries)chart.Series.Add(SeriesType.Bar);
bar.Values.Add(10);
bar.Values.Add(10);
bar.Values.Add(10);
NSelectorTool selector = new NSelectorTool();
selector.SelectionChanged += new EventHandler(selector_SelectionChanged);
nChartControl1.Controller.Tools.Add(selector);
nChartControl1.Controller.Tools.Add(new NDataPointDragTool());
}
void selector_SelectionChanged(object sender, EventArgs e)
{
NSelection selection = nChartControl1.Controller.Selection;
if (selection.SelectedObjects.Count > 0)
{
for (int i = selection.SelectedObjects.Count - 1; i >= 0; i--)
{
NDataPoint dp = selection.SelectedObjects[i] as NDataPoint;
if (dp.IndexInSeries == 0 || dp.IndexInSeries == 2)
{
selection.SelectedObjects.RemoveAt(i);
}
}
}
}
Best Regards,
Nevron Support Team