Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 141
Default Determining chart points at mouse position

I can determine where the mouse is in a MouseUp event on a
chart (thanks to Greg and Jon for the helpful hints) but
converting that to chart points (not printing points --
1/72 in) and values is ludicrous.

I can estimate chart points (the chart X value) by using
the mouse position in printing points (1/72 in) and Left,
InsideWidth, the total number of X points on the charts,
and some silly math. However, if you float the mouse
pointer over a point on the graph, a Excel pop-up shows
the actual chart point and value. That's what I need!
Microsoft can do it; why can't I?

I suspect that if I could determine the index of the Point
object in the Points collection, I could then read the
values from the worksheet data. But how can I determine
that index? Is there another way?

I think my next post will have to be to a psychiatry group.

Steve

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 115
Default Determining chart points at mouse position

Steve -

Forget the mouse coordinates, it'll only enrich the psychiatrists. I
have some sample code to get information about clicked points, and you
can use a different event for mousing over the points:

Easy version, chart sheets only:
http://peltiertech.com/Excel/Zips/Ge...ChartSheet.zip

Harder, embedded charts:
http://peltiertech.com/Excel/Zips/GetXYonAnyChart.zip

Documentation is rather scant, but you should at least get an idea.

- Jon
-------
Jon Peltier, Microsoft Excel MVP
Peltier Technical Services
Tutorials and Custom Solutions
http://PeltierTech.com/
_______

Steve wrote:

I can determine where the mouse is in a MouseUp event on a
chart (thanks to Greg and Jon for the helpful hints) but
converting that to chart points (not printing points --
1/72 in) and values is ludicrous.

I can estimate chart points (the chart X value) by using
the mouse position in printing points (1/72 in) and Left,
InsideWidth, the total number of X points on the charts,
and some silly math. However, if you float the mouse
pointer over a point on the graph, a Excel pop-up shows
the actual chart point and value. That's what I need!
Microsoft can do it; why can't I?

I suspect that if I could determine the index of the Point
object in the Points collection, I could then read the
values from the worksheet data. But how can I determine
that index? Is there another way?

I think my next post will have to be to a psychiatry group.

Steve


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Determining chart points at mouse position

From the VBA help example for GetChartElement method of the Chart object:

Private Sub Chart_MouseMove(ByVal Button As Long, _
ByVal Shift As Long, ByVal X As Long, ByVal Y As Long)
Dim IDNum As Long
Dim a As Long
Dim b As Long

ActiveChart.GetChartElement X, Y, IDNum, a, b
If IDNum = xlLegendEntry Then _
MsgBox "WARNING: Move away from the legend"
End Sub

See excel VBA help for details:

expression.GetChartElement(X, Y, ElementID, Arg1, Arg2)
if the element is a series it returns

ElementID Arg1 Arg2
xlSeries SeriesIndex PointIndex

Unlike other type functions, the last 3 arguments are returned from
GetChartElement

--
Regards,
Tom Ogilvy

"Steve" wrote in message
...
I can determine where the mouse is in a MouseUp event on a
chart (thanks to Greg and Jon for the helpful hints) but
converting that to chart points (not printing points --
1/72 in) and values is ludicrous.

I can estimate chart points (the chart X value) by using
the mouse position in printing points (1/72 in) and Left,
InsideWidth, the total number of X points on the charts,
and some silly math. However, if you float the mouse
pointer over a point on the graph, a Excel pop-up shows
the actual chart point and value. That's what I need!
Microsoft can do it; why can't I?

I suspect that if I could determine the index of the Point
object in the Points collection, I could then read the
values from the worksheet data. But how can I determine
that index? Is there another way?

I think my next post will have to be to a psychiatry group.

Steve



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Need some plotting help - determining which points are farthest apart memilanuk[_2_] Excel Discussion (Misc queries) 5 May 23rd 09 01:33 AM
Position DataLables on a pivot pie chart realative to their Points Aaron Charts and Charting in Excel 0 September 1st 07 07:12 PM
Custom mouse over series points Don Guillett Charts and Charting in Excel 1 March 26th 06 09:49 PM
How do I show values of data points in a chart with the mouse poin warndt Charts and Charting in Excel 0 March 3rd 06 05:58 PM
Get points in a worksheet using mouse click Rock Excel Programming 3 April 13th 04 08:32 PM


All times are GMT +1. The time now is 11:12 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"