Make bars on a bar chart clickable?

  • Thread starter Thread starter Mark Stephens
  • Start date Start date
M

Mark Stephens

Is there a way to make the bars on a bar chart clickable. I can get the
functionality by coverin g them with an invisible shape but the problem is
that the size of the graph changes with changed data and so the covers don't
fit over the bars when it rescales. Another alternative I have thought could
work is to somehow measure the distance between vertical gridlines and then
draw a shape to the psecified dimension and align it to the x axis - pretty
complicated don't know if that could be done.

Any ideas much appreciated, kind regards, Mark
 
Hi Mark,

Can you not adapt the chart event codes you already have from your
previous posts?

If you go with the invisible covering shape why not simply cover the
whole chart and then work out what is under the mouse rather than having
multiple covers.

Cheers
Andy
 
Hi Andy,

Sorry for the belated reply, that's a great idea, but if I go with covering
the bars will I still be able to detect wherre I am in relatyion to them (or
I could program the coordinates in depending upon the number of bars in the
chart I guess). Thanks for the idea.

Mark
 
Mark -

The technique described in this article:

http://www.computorcompanion.com/LPMArticle.asp?ID=221

show how to determine which point was clicked on. No need for "knowing"
the coordinates, because the click event provides those, and the
GetChartElement uses them to find what you want.

The idea of having to keep track of rectangles covering bars in a chart,
in which the numbers of bars may change, the axes may recalculate, or
the chart itself may move, is giving me a headache.

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


Mark said:
Hi Andy,

Sorry for the belated reply, that's a great idea, but if I go with covering
the bars will I still be able to detect wherre I am in relatyion to them (or
I could program the coordinates in depending upon the number of bars in the
chart I guess). Thanks for the idea.

Mark
 
Back
Top