ASE Home Page Products Download Purchase Support About ASE
ChartDirector Support
Forum HomeForum Home   SearchSearch

Message ListMessage List     Post MessagePost Message

  zooming function not working
Posted by karlmarx on May-31-2014 13:02
Attachments:
hi am using demo chart Director, i try to use MouseWheelListener in java, but its not
working. i have used JFrame for frame works. I have attached my code below pls help me as
soon as possible.
Ibdxyline.java
Ibdxyline.java

9.72 Kb

  Re: zooming function not working
Posted by Peter Kwan on Jun-03-2014 00:39
Attachments:
Hi karlmarx,

For your case, your code tries displaysthe non-zoomed chart, then use
syncLinearAxisWithviewPort to ask ChartDirector to zoom it. Instead, please zoom the
chart first, then displays it.

So instead of:

viewer.setChart(c);

viewer.syncLinearAxisWithViewPort("x", c.xAxis());
viewer.syncLinearAxisWithViewPort("y", c.yAxis());

please change the above to:

viewer.syncLinearAxisWithViewPort("x", c.xAxis());
viewer.syncLinearAxisWithViewPort("y", c.yAxis());

viewer.setChart(c);


I noticed that Ibdxyline is not the complete application, but it seems to be invoked by
another GUI framework "SWT". For testing, I have removed the SWT part so that I can
run Ibdxyline, and it works normally (after making the above changes). I have attached
my modified test code for your reference.

Note that for mouse wheel events, sometimes the "parent" will intercept the events. For
example, consider viewing a web page. If you move the mouse over an image, the image
will receive the "mouse move" event. However, if you move the scroll wheel when the
mouse is over the image, the window will receive the mouse event (the entire web page
will scroll), not the image.

If you try my test code, and it works, and then you try it in SWT and it does not work,
one possibility is that the SWT parent is intercepting the mouse wheel event, so the
JFrame never sees the event. In fact, the following google link seems to suggest that the
SWT sometimes does not forward mouse wheel events to AWT (and hence SWING), and
some additional code in SWT may be necessary to make the mouse wheel event available
to AWT/SWING.

https://code.google.com/p/gama-platform/issues/detail?id=84#c13

Hope this can help.

Regards
Peter Kwan
Ibdxyline.java
Ibdxyline.java

10.06 Kb