Profile Picture

drag only a part of all the data points

Posted By Enjoyear Guo 12 Years Ago
Author
Message
Nevron Support
Posted 12 Years Ago
View Quick Profile
Supreme Being

Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)

Group: Forum Members
Last Active: Last Week
Posts: 3,054, Visits: 4,009

Hi,

You can inspect the ParentNode property of the data point to check which is the series containing the data point:

NSeriesBase series = dp.ParentNode as NSeriesBase;



Best Regards,
Nevron Support Team



Enjoyear Guo
Posted 12 Years Ago
View Quick Profile
Forum Member

Forum Member (30 reputation)Forum Member (30 reputation)Forum Member (30 reputation)Forum Member (30 reputation)Forum Member (30 reputation)Forum Member (30 reputation)Forum Member (30 reputation)Forum Member (30 reputation)Forum Member (30 reputation)

Group: Forum Members
Last Active: 12 Years Ago
Posts: 30, Visits: 1
What if I have more than one NBarSeries.

For example:
Assume we have 2 NBarSeries, named as NBarSeries1 and NBarSeries2.
For NBarSeries1, we have 3 data points, named as Point11,Point12,Point13.
For NBarSeries2, we have 3 data points, named as Point21,Point22,Point23.

If I want to make the NBarSeries1 undraggable, and NBarSeries2 draggable, by using your solution, the second point from both series will be draggable. Is there any easy way to tell which NBarSeries the second point belongs to? Thank you.


Nevron Support
Posted 12 Years Ago
View Quick Profile
Supreme Being

Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)

Group: Forum Members
Last Active: Last Week
Posts: 3,054, Visits: 4,009

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



Enjoyear Guo
Posted 12 Years Ago
View Quick Profile
Forum Member

Forum Member (30 reputation)Forum Member (30 reputation)Forum Member (30 reputation)Forum Member (30 reputation)Forum Member (30 reputation)Forum Member (30 reputation)Forum Member (30 reputation)Forum Member (30 reputation)Forum Member (30 reputation)

Group: Forum Members
Last Active: 12 Years Ago
Posts: 30, Visits: 1
Hi there,

I have several data series and other series on my chart. But I only want to make a small part of them draggable, not all the data points. So if I do the following:

NDataPointDragTool m_DataPointDragTool = new NDataPointDragTool();
m_DataPointDragTool.DepthAxisValue = 0;
nChartControl1.Controller.Tools.Add(m_DataPointDragTool);

It will enable every data point on the chart draggable. Is there any switch for the NPointSeries and any other series to turn on/off the dragging feature. Or maybe you have better ways to implement this.

Thank you very much.

Enjoyear



Similar Topics


Reading This Topic