We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Set InteractiveCursor to mouse position

Thread ID:

Created:

Updated:

Platform:

Replies:

145227 Jun 13,2019 03:06 AM UTC Jul 12,2019 08:36 AM UTC WinForms 5
loading
Tags: Chart
Ola Mallaug
Asked On June 13, 2019 03:06 AM UTC

I want to click on the graph and set a vertical cursor to the position on the graph where I clicked with the mouse.
The X-Axis on my graph is time. I also need the time to be able to look up values for all series on the graph at this time.

I can't figure out how to do this in WinForms. I'm using s line graph with several series.

Thanks!

Baby Palanidurai [Syncfusion]
Replied On June 13, 2019 12:16 PM UTC

Hi Ola, 

Greetings from Syncfusion. We have analyzed your query. As of now, we are having interactive cursor only. In that we couldn’t customize to provide some details about the information when on click. Please find the below documentation link for interactive cursor, 

We can show the information on mouse move using trackball features. Please find the below documentation link for track ball, 

Code snippet:  

this.chartControl1.PrimaryXAxis.ValueType = ChartValueType.DateTime; 
this.chartControl1.Trackball.DisplayMode = TrackballTooltipDisplayMode.Float; 
this.chartControl1.Trackball.Visible = true; 

Screenshot:  
 


If this is doesn’t meet your requirement, kindly revert us. 

Regards, 
Baby. 



Ola Mallaug
Replied On June 19, 2019 01:11 PM UTC

The trackball feature is a nice feature, but I'm really interested in the data from the graph when clicking on the graph. What you are saying is that there is no way to get the location or any data about where the user clicked on the graph?

Baby Palanidurai [Syncfusion]
Replied On June 20, 2019 10:05 AM UTC

Hi Ola, 

Thanks for your update. 

We have analyzed your query. We are having chartRegionClick event. In this event will return the point and series index as arguments. When we click apart from series points region, it will return point and series index as -1. So based on this, you can find the series and point index and the point values from this. If you want to show tooltip for these values in a click event, you need to draw the tooltip in own. 

We have prepared a sample with chartRegionClick event. In that event, we have shown the point x and y values in message box. 

Code snippet: 

this.chartControl1.ChartRegionClick += ChartControl1_ChartRegionClick; 

private void ChartControl1_ChartRegionClick(object sender, ChartRegionMouseEventArgs e) 
        { 
 
            int pointIndex = e.Region.PointIndex; 
            int seriesIndex = e.Region.SeriesIndex; 
 
            if (pointIndex != -1) 
            { 
                MessageBox.Show("X value: " + this.chartControl1.Series[seriesIndex].Points[pointIndex].X +"\nY value: " + this.chartControl1.Series[seriesIndex].Points[pointIndex].YValues[0]); 
            } 
        } 

Screenshot:  
 

For more information above chart events, kindly find the below documentation link, 

Kindly revert us, if you have any concerns. 

Regards, 
Baby. 


Ola Mallaug
Replied On July 12, 2019 01:35 AM UTC

Thank you for your help.


The demo works, I wish I didn't have to click on the graph trace itself, just on the graph and get the X position.

I tried to use this in my application and I get 'e.Region.PointIndex 'e.Region.PointIndex' threw an exception of type 'System.NullReferenceException'

My function and event are the same as the sample. I'm using the same version of Syncfusion as the sample as well. Any suggestion?

Baby Palanidurai [Syncfusion]
Replied On July 12, 2019 08:36 AM UTC

Hi Ola, 

Thanks for your update. 

We have checked your query and event is working at our end. Still we are not aware which is replicate the issue, so we couldn’t predict the issue at our end. Kindly provide your sample with replication steps which will be helpful in furthermore analysis and provide you the solution sooner. 

Regards, 
Baby.  


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon