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. Image for the cookie policy date

How do I get a line as an object When I click on it?

I am building a WindowsForm that connects to a database. So, if a user click one of the lines, then user could either get all the data or user could see the detail of a grouped chart. So, I need to know how to get a line as an object when I click it.

9 Replies

DJ Davis Jebaraj Syncfusion Team January 6, 2005 04:40 PM UTC

Hi, Each line in a Line Chart is exposed as a ChartRegion. You can handle the ChartRegionMouseDown event to know when the user clicks on a mouse and respond to the click. However, the current version has a problem that prevents the above event being raised for Line Charts. I have linked to a sample that shows this method with ColumnCharts. We will make the necessary changes to the LineChart at the earliest and make it available through a patch release. http://www.syncfusion.com/support/user/uploads/F23133ChartLineRegion.zip Thank you for your patience. Regards, Davis

RU Rune April 19, 2005 11:41 AM UTC

What is the status of this issue? Rune

DJ Davis Jebaraj Syncfusion Team April 19, 2005 07:29 PM UTC

Hi Rune, This issue has been fixed in version 3.2 Thanks, Davis

RU Rune April 21, 2005 02:53 PM UTC

I am trying to get the ChartPoint (X and Y values) in a line series when the mouse is moved over the point, but it seem that the ChartRegionMouseMove event is not fired. Is this the case for version 3.2? Is there another way to get the values, e.g by using the standard Mousemove event? regards Rune Selvåg

DJ Davis Jebaraj Syncfusion Team April 21, 2005 04:22 PM UTC

Hi Rune, The ChartRegionMouseMove event is raised with version 3.2 Could you please try testing with version 3.2 You could do this to handle the ChartControl''s mouse move event and get to the Region under the cursor (This approach would be slow if there are several points): private void chartControl1_MouseMove(object sender, System.Windows.Forms.MouseEventArgs e) { Point pt = new Point(e.X,e.Y); IList regions = this.chartControl1.GetChartRegions(); foreach(ChartRegion region in regions) { if(region.IsChartPoint && region.Region.IsVisible(pt)) OutputText(String.Format("Click Series 1 Line {0} Point : {1}", region.PointIndex, pt)); } } Thanks, Davis

AD Administrator Syncfusion Team April 21, 2005 08:51 PM UTC

Thank you for the reply Davis. Using the MouseMove event would be to slow because i have many points in my series. I have already testet it with version 3.2. The normal MouseMove event is fired, but not the ChartRegionMouseMove event. I have Essential Studio version RC. The odd thing is that the ChartRegionMouseHover method is fired. I am not at work now, but i will test it again tomorrow and get back to you with source code. Any hints now to what can be causing this? Rune

RU Rune April 22, 2005 08:30 AM UTC

Hi again. I have now tested some more. It seems that the event stops fireing when removing the legend (Setting visible to false). I also had some trouble removing the legend. When i set visible to false in the designer, it was removed there, but when i ran the app it was floating (?). I did my tests on ChartrGridLinesSample. I also set "chartControl1.Legend.Visible = false" in code, and finally the legend didn''t show. It is when the legend no longer is visible the event stops fiering. Is this a bug? Regards Rune

DJ Davis Jebaraj Syncfusion Team April 25, 2005 10:18 PM UTC

Hi Rune, Thanks for the information. Yes, this appears to be a bug. I have asked our development team to look into this and fix it at the earliest. Thank you for your patience. Regards, Davis

RU Rune April 26, 2005 06:54 AM UTC

OK, thank you for the reply. This is not a big issue for me right now, i''ll just show the legend until the fix is in place. I also have another minor issue with the chart, but i''ll start another thread on that. Regards Rune

Live Chat Icon For mobile
Up arrow icon