+ Reply to Thread
Results 1 to 7 of 7

Can I grab graph coordinates in Excel via the mouse with VB?

Hybrid View

Guest Can I grab graph coordinates... 05-25-2005, 05:06 PM
Guest Re: Can I grab graph... 05-28-2005, 02:05 AM
Guest Re: Can I grab graph... 08-19-2005, 01:05 PM
Guest Re: Can I grab graph... 08-20-2005, 12:05 AM
Guest Re: Can I grab graph... 08-20-2005, 09:05 AM
  1. #1
    Chris Manning
    Guest

    Can I grab graph coordinates in Excel via the mouse with VB?

    Is it possible to get the graph coordinates (i.e. the y coordinate of a
    graph) in Excel using Visual Basic coding (or other methods) and insert them
    into another cell? Specifically ,what I want to do is have the user click on
    a graph, and have the y-coordinate at the time of the click entered into a
    cell, or, alternatively, have the user click and drag across the graph and
    have the coordinates at the beginning click and at the end of the drag
    entered into two seperate cells. Further, the complete set of y-coordinates
    is a column of data points, not a fcn if that helps at all.

  2. #2
    Jon Peltier
    Guest

    Re: Can I grab graph coordinates in Excel via the mouse with VB?

    Chris -

    You can trap events in the chart. I wrote an article about this:

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

    and I have a couple examples showing how to get values by clicking on a
    plotted point:

    http://peltiertech.com/Excel/Charts/...html#PointInfo

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


    Chris Manning wrote:

    > Is it possible to get the graph coordinates (i.e. the y coordinate of a
    > graph) in Excel using Visual Basic coding (or other methods) and insert them
    > into another cell? Specifically ,what I want to do is have the user click on
    > a graph, and have the y-coordinate at the time of the click entered into a
    > cell, or, alternatively, have the user click and drag across the graph and
    > have the coordinates at the beginning click and at the end of the drag
    > entered into two seperate cells. Further, the complete set of y-coordinates
    > is a column of data points, not a fcn if that helps at all.


  3. #3
    Chip
    Guest

    Re: Can I grab graph coordinates in Excel via the mouse with VB?

    Great articles. My question relates to gridlines. Can I click a gridline and
    get all the datapoints that intersect that gridline. My chart will have time
    as the x-axis with many elements graphed as lines. I would like to display
    the values of all elements at a given time represented by the gridline.

    "Jon Peltier" wrote:

    > Chris -
    >
    > You can trap events in the chart. I wrote an article about this:
    >
    > http://www.computorcompanion.com/LPMArticle.asp?ID=221
    >
    > and I have a couple examples showing how to get values by clicking on a
    > plotted point:
    >
    > http://peltiertech.com/Excel/Charts/...html#PointInfo
    >
    > - Jon
    > -------
    > Jon Peltier, Microsoft Excel MVP
    > Peltier Technical Services
    > Tutorials and Custom Solutions
    > http://PeltierTech.com/
    > _______
    >
    >
    > Chris Manning wrote:
    >
    > > Is it possible to get the graph coordinates (i.e. the y coordinate of a
    > > graph) in Excel using Visual Basic coding (or other methods) and insert them
    > > into another cell? Specifically ,what I want to do is have the user click on
    > > a graph, and have the y-coordinate at the time of the click entered into a
    > > cell, or, alternatively, have the user click and drag across the graph and
    > > have the coordinates at the beginning click and at the end of the drag
    > > entered into two seperate cells. Further, the complete set of y-coordinates
    > > is a column of data points, not a fcn if that helps at all.

    >


  4. #4
    Jon Peltier
    Guest

    Re: Can I grab graph coordinates in Excel via the mouse with VB?

    It's not a native Excel feature, but if you're clever, you can probably
    work it out. You need to determine which gridline was clicked, then go
    through each series to find line segments that cross this value, and
    interpolate the Y value at the time in question (unless you happen to
    have actual data points for each series at this time value).

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


    Chip wrote:

    > Great articles. My question relates to gridlines. Can I click a gridline and
    > get all the datapoints that intersect that gridline. My chart will have time
    > as the x-axis with many elements graphed as lines. I would like to display
    > the values of all elements at a given time represented by the gridline.
    >
    > "Jon Peltier" wrote:
    >
    >
    >>Chris -
    >>
    >>You can trap events in the chart. I wrote an article about this:
    >>
    >> http://www.computorcompanion.com/LPMArticle.asp?ID=221
    >>
    >>and I have a couple examples showing how to get values by clicking on a
    >>plotted point:
    >>
    >> http://peltiertech.com/Excel/Charts/...html#PointInfo
    >>
    >>- Jon
    >>-------
    >>Jon Peltier, Microsoft Excel MVP
    >>Peltier Technical Services
    >>Tutorials and Custom Solutions
    >>http://PeltierTech.com/
    >>_______
    >>
    >>
    >>Chris Manning wrote:
    >>
    >>
    >>>Is it possible to get the graph coordinates (i.e. the y coordinate of a
    >>>graph) in Excel using Visual Basic coding (or other methods) and insert them
    >>>into another cell? Specifically ,what I want to do is have the user click on
    >>>a graph, and have the y-coordinate at the time of the click entered into a
    >>>cell, or, alternatively, have the user click and drag across the graph and
    >>>have the coordinates at the beginning click and at the end of the drag
    >>>entered into two seperate cells. Further, the complete set of y-coordinates
    >>>is a column of data points, not a fcn if that helps at all.

    >>


  5. #5
    Chip
    Guest

    Re: Can I grab graph coordinates in Excel via the mouse with VB?

    I believe arg2 is what determines which gridline. Correct?

    "Jon Peltier" wrote:

    > It's not a native Excel feature, but if you're clever, you can probably
    > work it out. You need to determine which gridline was clicked, then go
    > through each series to find line segments that cross this value, and
    > interpolate the Y value at the time in question (unless you happen to
    > have actual data points for each series at this time value).
    >
    > - Jon
    > -------
    > Jon Peltier, Microsoft Excel MVP
    > Peltier Technical Services
    > Tutorials and Custom Solutions
    > http://PeltierTech.com/
    > _______
    >
    >
    > Chip wrote:
    >
    > > Great articles. My question relates to gridlines. Can I click a gridline and
    > > get all the datapoints that intersect that gridline. My chart will have time
    > > as the x-axis with many elements graphed as lines. I would like to display
    > > the values of all elements at a given time represented by the gridline.
    > >
    > > "Jon Peltier" wrote:
    > >
    > >
    > >>Chris -
    > >>
    > >>You can trap events in the chart. I wrote an article about this:
    > >>
    > >> http://www.computorcompanion.com/LPMArticle.asp?ID=221
    > >>
    > >>and I have a couple examples showing how to get values by clicking on a
    > >>plotted point:
    > >>
    > >> http://peltiertech.com/Excel/Charts/...html#PointInfo
    > >>
    > >>- Jon
    > >>-------
    > >>Jon Peltier, Microsoft Excel MVP
    > >>Peltier Technical Services
    > >>Tutorials and Custom Solutions
    > >>http://PeltierTech.com/
    > >>_______
    > >>
    > >>
    > >>Chris Manning wrote:
    > >>
    > >>
    > >>>Is it possible to get the graph coordinates (i.e. the y coordinate of a
    > >>>graph) in Excel using Visual Basic coding (or other methods) and insert them
    > >>>into another cell? Specifically ,what I want to do is have the user click on
    > >>>a graph, and have the y-coordinate at the time of the click entered into a
    > >>>cell, or, alternatively, have the user click and drag across the graph and
    > >>>have the coordinates at the beginning click and at the end of the drag
    > >>>entered into two seperate cells. Further, the complete set of y-coordinates
    > >>>is a column of data points, not a fcn if that helps at all.
    > >>

    >


  6. #6
    Jon Peltier
    Guest

    Re: Can I grab graph coordinates in Excel via the mouse with VB?

    Element ID is 15 (xlMajorGridlines) or 16 (xlMinorGridlines) when the gridlines are
    selected.
    Arg1 is always 1, since gridlines are only associated with primary axes.
    Arg2 is 1 for the category (X) axis or 2 for the value (Y) axis.

    Since you can only select the set of gridlines, not a single one, you cannot tell
    which individual gridline was selected.

    You can use a MouseUp event to get the X and Y coordinates of the click. These are
    in chart window coordinates, not the X and Y of the chart axis coordinates. You can
    determine which is the closest date based on this, but it takes a bunch of algebraic
    calculations.

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

    Chip wrote:
    > I believe arg2 is what determines which gridline. Correct?
    >
    > "Jon Peltier" wrote:
    >
    >
    >>It's not a native Excel feature, but if you're clever, you can probably
    >>work it out. You need to determine which gridline was clicked, then go
    >>through each series to find line segments that cross this value, and
    >>interpolate the Y value at the time in question (unless you happen to
    >>have actual data points for each series at this time value).
    >>
    >>- Jon
    >>-------
    >>Jon Peltier, Microsoft Excel MVP
    >>Peltier Technical Services
    >>Tutorials and Custom Solutions
    >>http://PeltierTech.com/
    >>_______
    >>
    >>
    >>Chip wrote:
    >>
    >>
    >>>Great articles. My question relates to gridlines. Can I click a gridline and
    >>>get all the datapoints that intersect that gridline. My chart will have time
    >>>as the x-axis with many elements graphed as lines. I would like to display
    >>>the values of all elements at a given time represented by the gridline.
    >>>
    >>>"Jon Peltier" wrote:
    >>>
    >>>
    >>>
    >>>>Chris -
    >>>>
    >>>>You can trap events in the chart. I wrote an article about this:
    >>>>
    >>>> http://www.computorcompanion.com/LPMArticle.asp?ID=221
    >>>>
    >>>>and I have a couple examples showing how to get values by clicking on a
    >>>>plotted point:
    >>>>
    >>>> http://peltiertech.com/Excel/Charts/...html#PointInfo
    >>>>
    >>>>- Jon
    >>>>-------
    >>>>Jon Peltier, Microsoft Excel MVP
    >>>>Peltier Technical Services
    >>>>Tutorials and Custom Solutions
    >>>>http://PeltierTech.com/
    >>>>_______
    >>>>
    >>>>
    >>>>Chris Manning wrote:
    >>>>
    >>>>
    >>>>
    >>>>>Is it possible to get the graph coordinates (i.e. the y coordinate of a
    >>>>>graph) in Excel using Visual Basic coding (or other methods) and insert them
    >>>>>into another cell? Specifically ,what I want to do is have the user click on
    >>>>>a graph, and have the y-coordinate at the time of the click entered into a
    >>>>>cell, or, alternatively, have the user click and drag across the graph and
    >>>>>have the coordinates at the beginning click and at the end of the drag
    >>>>>entered into two seperate cells. Further, the complete set of y-coordinates
    >>>>>is a column of data points, not a fcn if that helps at all.
    >>>>



+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1