Sorry, client-side GChart does not provide a method for transforming
from pixels into model coordinates. It also does not provide a simple
way to select points using the mouse--it does not even provide a
simple way you can represent the selected/unselected state of a point.

If you implement a great mouse selection tool and want to contribute
it back to the product, I'll be most delighted to have been proven
wrong, but looking at your code and given how the product was
designed, in my expert opinion: don't waste any more time on this!

You CAN make a Client-side GChart interactive quite easily by adding
standard GWT widgets as chart annotations, footnotes, tick labels,
etc. and controlling the "display only" GChart's properties in
response to events from those widgets. The live demo's bar chart
(accessible from the GChart home page link below) provides a good
example of how to do this. Here's a link to another site that uses the
same simple technique to scroll a data set through a GChart via a
couple of next/previous buttons:

http://bocaciegapark.com/bocatides.php    (scroll down to see their
GChart)

For some applications, such scrolling (or some similar, widget-driven
technique) is a viable alternative to mouse point selection/zooming.

But, if you really need the mouse point selection zoom-in
functionality, it's best to use a different charting tool.
(I recall seeing a timepedia chronoscope demo a while back that did
the point selection/zoom in thing quite nicely).

John C. Gunther
http://gchart.googlecode.com

On Sep 23, 5:15 pm, amadeus <[EMAIL PROTECTED]> wrote:
> Hi,
> I'm using your software and I would add a simple zoom tool with mouse
> selection
> I need to know the exact position of axis origin (left bottom) to
> transform x,y mouse in chart's coordinates
>
> here my code
> after
>        sinkEvents(Event.ONMOUSEMOVE|Event.ONMOUSEDOWN|
> Event.ONMOUSEUP);
> I tried to calculate the origin
>         public void onBrowserEvent(Event event) {
>                 double x;
>                 double y;
>                 double mouseX=event.getClientX()-getAbsoluteLeft();
>                 double 
> mouseY=getAbsoluteTop()+getOffsetHeight()-event.getClientY();
>                 Axis xAxis = getXAxis();
>                 Axis yAxis = getYAxis();
>                 double dx=xAxis.getAxisLabelThickness() +
> xAxis.getTickLabelThickness() + xAxis.getTickLength();
>                 double dy=yAxis.getAxisLabelThickness() +
> yAxis.getTickLabelThickness() + yAxis.getTickLength();
>                 x=mouseX-dx;
>                 y=mouseY-dy;
>                 // transform in chart coordinates
>                 x=xmin+x*(xmax-xmin)/getXChartSize();
>                 y=ymin+y*(ymax-ymin)/getYChartSize();
> I'm on the right way or there is a simpler method?
> thanks
> Albert
> ps Excuse me for my english
>
> On 22 Set, 23:12, John Gunther <[EMAIL PROTECTED]> wrote:
>
> > Client-sideGChartis an open source GWT library that supports bar,
> > line, and pie charts, and yet adds nothing but its ~2,000 lines of
> > Java to your application's list of dependencies:
>
> >http://gchart.googlecode.com
>
> > This 2.2 release adds:
>
> > * A new LINE symbol type for faster/better solidly connected line
> > charts
> > * A new layout algorithm that centers title, footnotes, axis labels
> > and legend within explicitly-sizable bands around the plot area. In
> > particular, since these bands have default thicknesses of 0px when
> > empty, Sparkline charts are now straightforward.
>
> > For full details, including links to example charts illustrating the
> > new features, see theGChart2.2 release notes:
>
> >http://gchart.googlecode.com/svn/trunk/doc/com/googlecode/gchart/clie...
>
> > Related posts/acknowledgments:
>
> > 1) This post by Niall Haslam motivated the much-needed switch to a new
> > chart decoration layout algorithm:
>
> >http://groups.google.com/group/Google-Web-Toolkit/msg/5be9867eb81c9ca4
>
> > 2) I used the technique explained in this post by Ian Bambury
> > (http://examples.roughian.com) to workaround a perplexing IE7-only
> > screen-not-repainting problem that the revisions of this release
> > inadvertently exposed:
>
> >http://groups.google.com/group/Google-Web-Toolkit/msg/31b2d8e0eace6f3c
>
> > 3) The improved line chart capabilities were motivated by the far-too-
> > slowly-updating solidly connected line chart code that Malcolm Gorman
> > sent me. A new live demo chart, deliberately (HTML-element) sized
> > similarly to Malcolm's chart, illustrates various ways (smaller
> > charts, lower resolution connecting lines) you can use the new LINE
> > symbol type to workaround the significant performance limitations that
> > still remain for this kind of "non-rectangle-friendly" chart.
>
> > Your ideas for improving Client-sideGChartand help in solving its
> > implementation problems were essential to this 2.2 release. Thank-you.
>
> > John C. Guntherhttp://gchart.googlecode.com
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to Google-Web-Toolkit@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/Google-Web-Toolkit?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to