ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Getting the coordinates/ size of a bar chart element (https://www.excelbanter.com/excel-programming/271426-getting-coordinates-size-bar-chart-element.html)

Steve[_28_]

Getting the coordinates/ size of a bar chart element
 
I wonder if anyone can help with this

I want to get the xy (ref the screen not the chart) coordintates and the
size of a bar chart element when I click on it.
I am using the mousedown event to get the element and can get at the element
itself, its data etc etc but I can't seem to find a way to get to indo about
its size and position on the screen (eg Top, Left etc).

Is this possible ?

Steve



Jon Peltier[_3_]

Getting the coordinates/ size of a bar chart element
 
Hey Steve -

When you get your XY, what are you going to do with it? There may be an
easier way to go about it.

- Jon
-------
Jon Peltier, Microsoft Excel MVP
http://www.geocities.com/jonpeltier/Excel/index.html
_______

Steve wrote:
I wonder if anyone can help with this

I want to get the xy (ref the screen not the chart) coordintates and the
size of a bar chart element when I click on it.
I am using the mousedown event to get the element and can get at the element
itself, its data etc etc but I can't seem to find a way to get to indo about
its size and position on the screen (eg Top, Left etc).

Is this possible ?

Steve




Steve Allanson

Getting the coordinates/ size of a bar chart element
 
Jon

I have a drag and drop routine for individual elements of a stacked bar
chart - so that I can drag them (and the driving data) to different
places (ie a different order in the stacked bar or to a different
stack). One problem I have is that I want to create a rectangle exactly
the same size and position as the element selected so that this will be
visible during the drag operation.

I have now managed to achieve this by deducing the xy coords and the
size from the inside plot area property, the max point of the axis and
the cross over point, similarly for the category axis I have managed to
deduce what I want from the axis size and the parameter for bar spacing.
I can now create a rectangle with the mouse down event and can drag this
rectangle - driving the dotted line rectangle to be shown.

However, as always, I find a way to achieve what I want but not
necessarily the best way so if you know of anything I can do that is
better, quicker tidier I would appreciate your feedback.

Steve



*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Jon Peltier[_3_]

Getting the coordinates/ size of a bar chart element
 
Steve -

Sounds like you basically have done what I would have suggested. For
some things, there really isn't a "best way".

- Jon
-------
Jon Peltier, Microsoft Excel MVP
http://www.geocities.com/jonpeltier/Excel/index.html
_______

Steve Allanson wrote:
Jon

I have a drag and drop routine for individual elements of a stacked bar
chart - so that I can drag them (and the driving data) to different
places (ie a different order in the stacked bar or to a different
stack). One problem I have is that I want to create a rectangle exactly
the same size and position as the element selected so that this will be
visible during the drag operation.

I have now managed to achieve this by deducing the xy coords and the
size from the inside plot area property, the max point of the axis and
the cross over point, similarly for the category axis I have managed to
deduce what I want from the axis size and the parameter for bar spacing.
I can now create a rectangle with the mouse down event and can drag this
rectangle - driving the dotted line rectangle to be shown.

However, as always, I find a way to achieve what I want but not
necessarily the best way so if you know of anything I can do that is
better, quicker tidier I would appreciate your feedback.

Steve



*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!



Steve Allanson

Getting the coordinates/ size of a bar chart element
 
Ok

Thanks anyway Jon

Steve



*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!


All times are GMT +1. The time now is 08:45 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com