NDataPointDragTool with NAxisValueSnapper


Author
Message
cho seongho
cho seongho
Forum Newbie (9 reputation)Forum Newbie (9 reputation)Forum Newbie (9 reputation)Forum Newbie (9 reputation)Forum Newbie (9 reputation)Forum Newbie (9 reputation)Forum Newbie (9 reputation)Forum Newbie (9 reputation)Forum Newbie (9 reputation)
Group: Forum Members
Posts: 15, Visits: 73
Hi.

I want to move datapoint aligned with MinorTick.
Can I use NDataPointDragTool with NAxisValueSnapper?
Nevron Support
Nevron Support
Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)
Group: Administrators
Posts: 3.1K, Visits: 4.2K
Hi Cho,
The following code shows how to implement minor tick snapping while dragging a point a with the mouse:

class NCustomDataPointDragTool : NDataPointDragTool
{
protected override NDataPointXYZValue GetDataPointXYZValue(NVector3DF pointModel)
{
NDataPointXYZValue value = base.GetDataPointXYZValue(pointModel);

NChart chart = GetActiveChart();

value.X = chart.Axis(StandardAxis.PrimaryX).SnapValueToNearestMinorTick(value.X);

return value;
}
}

public Form1()
{
InitializeComponent();

NChart chart = nChartControl1.Charts[0];

NLinearScaleConfigurator scaleX = new NLinearScaleConfigurator();
scaleX.MinorTickCount = 2;
chart.Axis(StandardAxis.PrimaryX).ScaleConfigurator = scaleX;

NPointSeries point = new NPointSeries();
point.UseXValues = true;

point.Values.Add(10);
point.XValues.Add(10);

point.Values.Add(20);
point.XValues.Add(20);

point.Values.Add(30);
point.XValues.Add(30);

chart.Series.Add(point);

nChartControl1.Controller.Tools.Add(new NSelectorTool());

NCustomDataPointDragTool dragTool = new NCustomDataPointDragTool();
dragTool.DataPointChanged += DragTool_DataPointChanged;
nChartControl1.Controller.Tools.Add(dragTool);
}

Please note that for this to compile you need to download the latest version of .NET Vision as the GetDataPointXYZValue method was previously hidden (obfuscated).

Let us know if you meet any problems or have any questions.

Best Regards,
Nevron Support Team


GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search