Hi Allen,
The following example shows how to implement selective data point dragging. In this example the data points from the 'red' series cannot be dragged - this is achieved by creating a custom data point drag tool that overrides the CanBeginDrag method:
class MyDataPointDragTool : NDataPointDragTool
{
public override bool CanBeginDrag()
{
ArrayList selectedDataPoints = GetSelectedDataPoints();
if (selectedDataPoints == null)
return false;
foreach (NDataPoint dataPoint in selectedDataPoints)
{
NSeriesBase series = (NSeriesBase)dataPoint.ProvideReference(typeof(NSeriesBase));
if ((bool)series.Tag == false)
{
return false;
}
}
return base.CanBeginDrag();
}
}
Random random = new Random();
private void Form1_Load(object sender, EventArgs e)
{
NChart chart = nChartControl1.Charts[0];
chart.Series.Add(CreatePointSeries(Color.Red, false));
chart.Series.Add(CreatePointSeries(Color.Blue, true));
nChartControl1.Controller.Tools.Add(new NSelectorTool());
nChartControl1.Controller.Tools.Add(new MyDataPointDragTool());
}
private NPointSeries CreatePointSeries(Color color, bool draggable)
{
NPointSeries point = new NPointSeries();
point.FillStyle = new NColorFillStyle(color);
point.DataLabelStyle.Visible = false;
point.UseXValues = true;
point.Tag = draggable;
for (int i = 0; i < 10; i++)
{
point.Values.Add(random.Next(100));
point.XValues.Add(random.Next(100));
}
return point;
}
Hope this helps - let us know if you have any questions.
Best Regards,
Nevron Support Team