Profile Picture

Cannot change Cursor if mouse is over a DataPoint

Posted By Alexander Haberl 10 Years Ago
Author
Message
Alexander Haberl
Problem Posted 10 Years Ago
View Quick Profile
Forum Newbie

Forum Newbie (8 reputation)Forum Newbie (8 reputation)Forum Newbie (8 reputation)Forum Newbie (8 reputation)Forum Newbie (8 reputation)Forum Newbie (8 reputation)Forum Newbie (8 reputation)Forum Newbie (8 reputation)Forum Newbie (8 reputation)

Group: Forum Members
Last Active: Last Year
Posts: 15, Visits: 48
Since I upgraded to 2014.1 the following code does not work anymore (in 2012.1 it worked perfectly), the Cursor does not change (sometimes it flickers for a bit):
Also I noticed that in the C# examples (Interactivity->Mouse Events->Tracking Mouse Events), if you change the render mode to window, the Mouse move event does not work anymore!
How can I change the cursor to hand, if the mouse is over a DataPoint?

        /// <summary>
        /// Change Cursor if over a DataPoint!
        /// </summary>
        private void chartControl_MouseMove(object sender, MouseEventArgs e)
        {
            NHitTestResult htr = chartControl.HitTest(e.Location);

            if (htr.ChartElement == ChartElement.DataPoint)
            {
                NDataPoint dp = (NDataPoint)htr.Object;
                var series = (NSeriesBase)dp.ParentNode;
                if (series is NPointSeries)
                {
                    chartControl.Cursor = Cursors.Hand;
                    //Debug.WriteLine("Cursor should be changed to Hand!");
                }
            }
            else
            {
                chartControl.Cursor = Cursors.Default;
                //Debug.WriteLine("Cursor should be changed to Default!");
            }
        }




Nevron Support
Posted 10 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: Yesterday @ 1:54 AM
Posts: 3,054, Visits: 4,009
Hi Alexander,

You need to download a more recent version of the control as the issue with mouse move was fixed in one of the SPs of 2014. Regarding the cursor - when in window mode the control will create a child window inside the hosting control (in order to use hardware acceleration) so when you assign a cursor it will not be automatically applied on this window. To work around the problem you can assign cursor per data point in the following manner:

   NChart chart = nChartControl1.Charts[0];
   NBarSeries bar = new NBarSeries();
   bar.Values.Add(10);
   bar.Values.Add(20);
   bar.Values.Add(23);

   chart.Series.Add(bar);

   bar.InteractivityStyles[0] = new NInteractivityStyle(string.Empty, CursorType.Hand);
   bar.InteractivityStyles[1] = new NInteractivityStyle(string.Empty, CursorType.Hand);
   bar.InteractivityStyles[2] = new NInteractivityStyle(string.Empty, CursorType.Hand);

   nChartControl1.Controller.Tools.Add(new NCursorTool());
   nChartControl1.Settings.RenderSurface = RenderSurface.Window;
   nChartControl1.Refresh();

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



Best Regards,
Nevron Support Team





Similar Topics


Reading This Topic