My favorites | Sign in
Project Logo
                
New issue | Search
for
| Advanced search | Search tips
Issue 21: Client to model cordinates conversion method request
1 person starred this issue and may be notified of changes. Back to list
Status:  Verified
Owner:  johncurt...@gmail.com
Type-Defect
Priority-Medium
Milestone-Release2.41


Sign in to add a comment
 
Reported by saurabh.hirani, Feb 02, 2009
Hi, 

I was exploring GChart and I wanted to write a program which would capture
mouse click events along x-y axis of a chart and draw points on the chart
where mouse down occured. I could not find any methods in GChart API to
convert from client mouse cordinates to model cordinates of the chart. I
posted my query on GWT and got a reply from Mr. John Gunther explaining
thoroughly how the conversion can be done with an example to support it.
Thanks a million for that.

This is an enhancement request for adding a method for directly converting
from client cordinates to chart model cordinates. This feature would be
extremely useful in situations like highlighting a certain portion of an
already drawn chart.

regards,
Saurabh Hirani

Comment 1 by johncurt...@gmail.com, Feb 02, 2009
Appreciate your request.

I am planning to add a method getMouseCoordinate() to the Axis class that returns the
current mouse location (in that axis' model units) projected along that axis. So you
could write lines like

getCurve().addPoint(getXAxis().getMouseCoordinate(),getYAxis().getMouseCoordinate());

That's not exactly a client to model coordinate converter, but it would have allowed
your original request to have been satisfied, and it greatly simplified the "World's
Simplest Line Editor", making it more worthy of that name.

If such a method would not solve your problem, more details about what you are doing
would be appreciated. Before I got your issue I was planning to just release this
simple enhancement, and add actual client to model conversion if/when specific
examples came up that required it.

John 
Status: Accepted
Comment 2 by johncurt...@gmail.com, Feb 02, 2009
(No comment was entered for this change.)
Owner: johncurtisgunther
Comment 3 by saurabh.hirani, Feb 03, 2009
getCurve().addPoint(getXAxis().getMouseCoordinate(),getYAxis().getMouseCoordinate());

That would work for me. In fact, it would be better than the client to model
converter as it would also spare me the effort of looking at getClientX or
getClientY. And as my marking of areas would be limited to the chart, having a
function which maps mouse cordinates to model units along the axis would be good enough.
Comment 4 by johncurt...@gmail.com, Feb 10, 2009
(No comment was entered for this change.)
Labels: Milestone-Release2.41
Comment 5 by johncurt...@gmail.com, Feb 12, 2009
See the first section of the 2.41 release notes (available via a link from
the home page) for a description of the getMouseCoordinate, clientToModel,
and modelToClient methods that address this issue.

By sharing your ideas you have materially improved GChart. Please pass
along similarly useful stuff you notice as you use GChart.

John
Status: Verified
Comment 6 by saurabh.hirani, Jul 29, 2009
Saw that. Thanks for adding the feature. I appreciate your prompt follow ups on
requests and making GChart such a great tool.
Sign in to add a comment

Hosted by Google Code