Quinn-Curtis Forums
Quinn-Curtis Forums
Home | Profile | Register | Active Topics | Members | Search | FAQ
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 Tools for Microsoft .Net & .Net Compact Framework
 SPC Control Chart Tools for .Net
 How to catch the point when it was clicked?
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

fanyorn

3 Posts

Posted - 30 Aug 2009 :  12:07:13  Show Profile  Reply with Quote
Hi,
how to get the point's index when I double click the point on the chart,I have searched all of example CS codes about MouseListener,but there seems no means to get this index value.

Thanks.

quinncurtis

1164 Posts

Posted - 30 Aug 2009 :  18:57:15  Show Profile  Reply with Quote
You can use a subclass of the DataToolTip class, much like the ChartZoom class in the previous example

class CustomToolTip : DataToolTip
        {
            public CustomToolTip(ChartView component)
                : base(component)
            {
            }

            public override void OnDoubleClick(EventArgs me)
            {
                MouseEventArgs mouseevent = (MouseEventArgs)me;
                Point2D mousepos = new Point2D();
                mousepos.SetLocation(mouseevent.X, mouseevent.Y);
                base.OnDoubleClick(me);

                ChartPlot selectedPlot = (ChartPlot)GetSelectedPlotObj();
                if (selectedPlot != null)
                {
                    int selectedindex = GetNearestPoint().GetNearestPointIndex();
                    PhysicalCoordinates transform = GetSelectedCoordinateSystem();


                }
            }
        }


Install it in the main part of the program using code similar to:

CustomToolTip tooltip = new CustomToolTip(this);
            tooltip.SetDataToolTipFormat(ChartObj.DATA_TOOLTIP_CUSTOM);
            tooltip.SetEnable(true);
            this.SetCurrentMouseListener(tooltip);


If you are still using a trial version of the software after more than 30 days, you should think about getting a commercial license.
Go to Top of Page

fanyorn

3 Posts

Posted - 01 Sep 2009 :  11:46:53  Show Profile  Reply with Quote
Thank for your reply,it works now,but we found a strange problem:
The event was not invoked when the following codes was added:
this.HScrollBar1.Value = this.HScrollBar1.Maximum - numdatapointsinview;


Could you please give some explanation about it?

By the way,we now just doing some funtion test on this library,and we are sure of considering the purchase if there is no function problem. -:)

Thanks.
Go to Top of Page

quinncurtis

1164 Posts

Posted - 01 Sep 2009 :  13:47:25  Show Profile  Reply with Quote
You found a flaw in adding an external mouse listener the way we described. Once the scroll bar forces a change, or rebuilding of the graph, the mouse listeners are reset, and only the standard ones are reinitialized for the new graph. External ones like the one you added are not. We can describe simple workaround, but we will wait until you actually own the software.
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
Quinn-Curtis Forums © 2000-07 Quinn-Curtis, Inc. Go To Top Of Page
Powered By: Snitz Forums 2000 Version 3.4.07