Quinn-Curtis Forums
Quinn-Curtis Forums
Home | Profile | Register | Active Topics | Members | Search | FAQ
 All Forums
 Tools for Java
 QCChart2D for Java
 Example of ChartMouseListener

Note: You must be registered in order to post a reply.
To register, click here. Registration is FREE!

Screensize:
UserName:
Password:
Format Mode:
Format: BoldItalicizedUnderlineStrikethrough Align LeftCenteredAlign Right Horizontal Rule Insert HyperlinkInsert EmailInsert Image Insert CodeInsert QuoteInsert List
   
Message:

* HTML is OFF
* Forum Code is ON
Smilies
Smile [:)] Big Smile [:D] Cool [8D] Blush [:I]
Tongue [:P] Evil [):] Wink [;)] Clown [:o)]
Black Eye [B)] Eight Ball [8] Frown [:(] Shy [8)]
Shocked [:0] Angry [:(!] Dead [xx(] Sleepy [|)]
Kisses [:X] Approve [^] Disapprove [V] Question [?]

 
   

T O P I C    R E V I E W
johnbutler Posted - 11 Nov 2005 : 13:28:33
Is there an example of just a ChartMouseListener? Specifically, how do I trap on mouse event that occur just within the graph region? Or how do I convert the Point returned in the mouseEvent from being relative to the ChartView to being relative to the graph?

What I want to do is know at what position in the x-axis did the click occur. So if the x-axis scale is from 50 to 100 and the click occurs in the middle, I need to get 75.
2   L A T E S T    R E P L I E S    (Newest First)
quinncurtis Posted - 16 Nov 2005 : 10:30:01
Sorry, we do not know that answer to your question. We derived our DataCursor from the standard Java javax.swing.event.MouseInputListener, so your question really applies to that class. MouseInputListener does not provide specific functions for double click or Ctrl-click, though it is probably possible to implement them indirectly. You may be able to find some answers on generic Java programming forums. If it is critical to your application you can hire our programming services group to write some sort of custom interface for you.

quinncurtis Posted - 11 Nov 2005 : 15:15:23
Sorry, we do not have a ready made example that does what you describe.

You should be able to use a MouseInputListener object derived from DataCursor. The point p ends up with the physical coordinates of the mouse cursor at mouse pressed and mouse released.

public class CustomChartDataCursor2 extends DataCursor {
  public CustomChartDataCursor2(ChartView achartview, CartesianCoordinates thetransform,
                       int nmarkertype,
                       double rsize)
  {
        super(achartview, thetransform, nmarkertype, rsize);
  }
   
   // override mouseReleased method in order to add stuff
   public void mousePressed(MouseEvent event)
    {
   	  super.mousePressed(event);
   	  ChartPoint2D p = getLocation(ChartObj.PHYS_POS);
    }

  // override mouseReleased method in order to add stuff
   public void mouseReleased (MouseEvent event)
    {
   	  super.mouseReleased(event);
   	  ChartPoint2D p = getLocation(ChartObj.PHYS_POS);
    }
  }

.
.
.

 CustomChartDataCursor2 dataCursorObj = new CustomChartDataCursor2( gWG, pTransform1,
            ChartConstants.MARKER_NULL, 8.0);

 dataCursorObj.setDataCursorEnable(true);
 dataCursorObj.addDataCursorListener();

Quinn-Curtis Forums © 2000-2018 Quinn-Curtis, Inc. Go To Top Of Page
Powered By: Snitz Forums 2000 Version 3.4.07