+ Reply to Thread
Results 1 to 7 of 7

Clickable pie chart - anyone know how this might be achieved?

  1. #1
    Mark Stephens
    Guest

    Clickable pie chart - anyone know how this might be achieved?

    I want to do a 3D pie chart embedded in a work sheet and allow each piece if
    the pie to be 'clickable' i.e run a designated macro when clicked.

    One way that occurs to me (but hard in itself) would be to put an invisible
    cover (autoshape) over the piece and then assign the macro to it; but how
    would I go about matching its size and shape to the correct dimension and
    position of the pie peice?

    Another compromise (if as I think my ideal way is impossible) would be to
    try and detect the label position (less variable than the pie piece and a
    convenient rectangle) and then place an invisible cover over the label and
    then assign the macro with and 'on action' command.

    There's usually a way of achieveing most anything but this seems to be a
    tough one, any suggestions appreciated.

    Kind regards, Mark Stephens



  2. #2
    Andy Pope
    Guest

    Re: Clickable pie chart - anyone know how this might be achieved?

    Hi,

    You can make use of the doubleclick event.

    Take a look at John's article on hi-liting lines in a chart.
    http://www.pdbook.com/index.php/excel/comment/635/

    Using that as a base add this code. Then once the Connect routine has
    been run try selecting a slicing and doubleclicking it.

    Private Sub Cht_BeforeDoubleClick(ByVal ElementID As Long, _
    ByVal Arg1 As Long, ByVal Arg2 As Long, Cancel As Boolean)

    If ElementID = xlSeries Then
    If Arg2 > 0 Then
    MsgBox "Run a macro for Slice " & Arg2
    Cancel = True
    End If
    End If
    End Sub

    Cheers
    Andy

    Mark Stephens wrote:
    > I want to do a 3D pie chart embedded in a work sheet and allow each piece if
    > the pie to be 'clickable' i.e run a designated macro when clicked.
    >
    > One way that occurs to me (but hard in itself) would be to put an invisible
    > cover (autoshape) over the piece and then assign the macro to it; but how
    > would I go about matching its size and shape to the correct dimension and
    > position of the pie peice?
    >
    > Another compromise (if as I think my ideal way is impossible) would be to
    > try and detect the label position (less variable than the pie piece and a
    > convenient rectangle) and then place an invisible cover over the label and
    > then assign the macro with and 'on action' command.
    >
    > There's usually a way of achieveing most anything but this seems to be a
    > tough one, any suggestions appreciated.
    >
    > Kind regards, Mark Stephens
    >
    >


    --

    Andy Pope, Microsoft MVP - Excel
    http://www.andypope.info

  3. #3
    Mark Stephens
    Guest

    Re: Clickable pie chart - anyone know how this might be achieved?

    Thanks a lot for that Andy, it looks promising, will have a go and let you
    know how I get on, rgds, Mark


    "Andy Pope" <[email protected]> wrote in message
    news:%[email protected]...
    > Hi,
    >
    > You can make use of the doubleclick event.
    >
    > Take a look at John's article on hi-liting lines in a chart.
    > http://www.pdbook.com/index.php/excel/comment/635/
    >
    > Using that as a base add this code. Then once the Connect routine has been
    > run try selecting a slicing and doubleclicking it.
    >
    > Private Sub Cht_BeforeDoubleClick(ByVal ElementID As Long, _
    > ByVal Arg1 As Long, ByVal Arg2 As Long, Cancel As Boolean)
    >
    > If ElementID = xlSeries Then
    > If Arg2 > 0 Then
    > MsgBox "Run a macro for Slice " & Arg2
    > Cancel = True
    > End If
    > End If
    > End Sub
    >
    > Cheers
    > Andy
    >
    > Mark Stephens wrote:
    >> I want to do a 3D pie chart embedded in a work sheet and allow each piece
    >> if the pie to be 'clickable' i.e run a designated macro when clicked.
    >>
    >> One way that occurs to me (but hard in itself) would be to put an
    >> invisible cover (autoshape) over the piece and then assign the macro to
    >> it; but how would I go about matching its size and shape to the correct
    >> dimension and position of the pie peice?
    >>
    >> Another compromise (if as I think my ideal way is impossible) would be to
    >> try and detect the label position (less variable than the pie piece and a
    >> convenient rectangle) and then place an invisible cover over the label
    >> and then assign the macro with and 'on action' command.
    >>
    >> There's usually a way of achieveing most anything but this seems to be a
    >> tough one, any suggestions appreciated.
    >>
    >> Kind regards, Mark Stephens

    >
    > --
    >
    > Andy Pope, Microsoft MVP - Excel
    > http://www.andypope.info




  4. #4
    Mark Stephens
    Guest

    Re: Clickable pie chart - anyone know how this might be achieved?

    Hi Andy,

    Tried the code but when I tried to connect the chart I got the following
    error message:

    Compile error:

    User-defined type not defined


    Any ideas where I've gone wrong?

    Thks, Mark

    "Andy Pope" <[email protected]> wrote in message
    news:%[email protected]...
    > Hi,
    >
    > You can make use of the doubleclick event.
    >
    > Take a look at John's article on hi-liting lines in a chart.
    > http://www.pdbook.com/index.php/excel/comment/635/
    >
    > Using that as a base add this code. Then once the Connect routine has been
    > run try selecting a slicing and doubleclicking it.
    >
    > Private Sub Cht_BeforeDoubleClick(ByVal ElementID As Long, _
    > ByVal Arg1 As Long, ByVal Arg2 As Long, Cancel As Boolean)
    >
    > If ElementID = xlSeries Then
    > If Arg2 > 0 Then
    > MsgBox "Run a macro for Slice " & Arg2
    > Cancel = True
    > End If
    > End If
    > End Sub
    >
    > Cheers
    > Andy
    >
    > Mark Stephens wrote:
    >> I want to do a 3D pie chart embedded in a work sheet and allow each piece
    >> if the pie to be 'clickable' i.e run a designated macro when clicked.
    >>
    >> One way that occurs to me (but hard in itself) would be to put an
    >> invisible cover (autoshape) over the piece and then assign the macro to
    >> it; but how would I go about matching its size and shape to the correct
    >> dimension and position of the pie peice?
    >>
    >> Another compromise (if as I think my ideal way is impossible) would be to
    >> try and detect the label position (less variable than the pie piece and a
    >> convenient rectangle) and then place an invisible cover over the label
    >> and then assign the macro with and 'on action' command.
    >>
    >> There's usually a way of achieveing most anything but this seems to be a
    >> tough one, any suggestions appreciated.
    >>
    >> Kind regards, Mark Stephens

    >
    > --
    >
    > Andy Pope, Microsoft MVP - Excel
    > http://www.andypope.info




  5. #5
    Mark Stephens
    Guest

    Re: Clickable pie chart - anyone know how this might be achieved?

    Hey Andy,

    Works like a dream, you've bought a very nice smile to my face thanks very
    much for that



    "Andy Pope" <[email protected]> wrote in message
    news:%[email protected]...
    > Hi,
    >
    > You can make use of the doubleclick event.
    >
    > Take a look at John's article on hi-liting lines in a chart.
    > http://www.pdbook.com/index.php/excel/comment/635/
    >
    > Using that as a base add this code. Then once the Connect routine has been
    > run try selecting a slicing and doubleclicking it.
    >
    > Private Sub Cht_BeforeDoubleClick(ByVal ElementID As Long, _
    > ByVal Arg1 As Long, ByVal Arg2 As Long, Cancel As Boolean)
    >
    > If ElementID = xlSeries Then
    > If Arg2 > 0 Then
    > MsgBox "Run a macro for Slice " & Arg2
    > Cancel = True
    > End If
    > End If
    > End Sub
    >
    > Cheers
    > Andy
    >
    > Mark Stephens wrote:
    >> I want to do a 3D pie chart embedded in a work sheet and allow each piece
    >> if the pie to be 'clickable' i.e run a designated macro when clicked.
    >>
    >> One way that occurs to me (but hard in itself) would be to put an
    >> invisible cover (autoshape) over the piece and then assign the macro to
    >> it; but how would I go about matching its size and shape to the correct
    >> dimension and position of the pie peice?
    >>
    >> Another compromise (if as I think my ideal way is impossible) would be to
    >> try and detect the label position (less variable than the pie piece and a
    >> convenient rectangle) and then place an invisible cover over the label
    >> and then assign the macro with and 'on action' command.
    >>
    >> There's usually a way of achieveing most anything but this seems to be a
    >> tough one, any suggestions appreciated.
    >>
    >> Kind regards, Mark Stephens

    >
    > --
    >
    > Andy Pope, Microsoft MVP - Excel
    > http://www.andypope.info




  6. #6
    Mark Stephens
    Guest

    Re: Clickable pie chart - anyone know how this might be achieved?

    Hi Andy (or anyone else who may be looking in)

    The line chart hilight effect is really great (especially on a black
    bacground). Do you know how one would modify it so that you for example have
    an autoshape the same colour as the line on the chart and when you mouse
    over it it lights up (hilites, it really is a great effect) the line on the
    chart?

    The other effect I would really love to achieve is a similar effect with the
    pie chart where when you mouse over a slice, it's border hilites in the same
    way as the line on the line chart.

    Thanks again, kind regards, Mark



    "Andy Pope" <[email protected]> wrote in message
    news:%[email protected]...
    > Hi,
    >
    > You can make use of the doubleclick event.
    >
    > Take a look at John's article on hi-liting lines in a chart.
    > http://www.pdbook.com/index.php/excel/comment/635/
    >
    > Using that as a base add this code. Then once the Connect routine has been
    > run try selecting a slicing and doubleclicking it.
    >
    > Private Sub Cht_BeforeDoubleClick(ByVal ElementID As Long, _
    > ByVal Arg1 As Long, ByVal Arg2 As Long, Cancel As Boolean)
    >
    > If ElementID = xlSeries Then
    > If Arg2 > 0 Then
    > MsgBox "Run a macro for Slice " & Arg2
    > Cancel = True
    > End If
    > End If
    > End Sub
    >
    > Cheers
    > Andy
    >
    > Mark Stephens wrote:
    >> I want to do a 3D pie chart embedded in a work sheet and allow each piece
    >> if the pie to be 'clickable' i.e run a designated macro when clicked.
    >>
    >> One way that occurs to me (but hard in itself) would be to put an
    >> invisible cover (autoshape) over the piece and then assign the macro to
    >> it; but how would I go about matching its size and shape to the correct
    >> dimension and position of the pie peice?
    >>
    >> Another compromise (if as I think my ideal way is impossible) would be to
    >> try and detect the label position (less variable than the pie piece and a
    >> convenient rectangle) and then place an invisible cover over the label
    >> and then assign the macro with and 'on action' command.
    >>
    >> There's usually a way of achieveing most anything but this seems to be a
    >> tough one, any suggestions appreciated.
    >>
    >> Kind regards, Mark Stephens

    >
    > --
    >
    > Andy Pope, Microsoft MVP - Excel
    > http://www.andypope.info




  7. #7
    Jon Peltier
    Guest

    Re: Clickable pie chart - anyone know how this might be achieved?

    For the pie chart, you want to the border formatting of a single point. Andy's
    highlighting effect that changes the data in a second line chart series so it
    temporarily appears won't work with the pie, but the other approaches that change
    the connecting line format can be modified. Record a macro while you change the
    formatting of a pie slice to see the syntax.

    Note that you need to know which point you are mousing over, so you need to use Arg2
    (point number) as well as Arg1 (series number).

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

    Mark Stephens wrote:

    > Hi Andy (or anyone else who may be looking in)
    >
    > The line chart hilight effect is really great (especially on a black
    > bacground). Do you know how one would modify it so that you for example have
    > an autoshape the same colour as the line on the chart and when you mouse
    > over it it lights up (hilites, it really is a great effect) the line on the
    > chart?
    >
    > The other effect I would really love to achieve is a similar effect with the
    > pie chart where when you mouse over a slice, it's border hilites in the same
    > way as the line on the line chart.
    >
    > Thanks again, kind regards, Mark
    >
    >
    >
    > "Andy Pope" <[email protected]> wrote in message
    > news:%[email protected]...
    >
    >>Hi,
    >>
    >>You can make use of the doubleclick event.
    >>
    >>Take a look at John's article on hi-liting lines in a chart.
    >>http://www.pdbook.com/index.php/excel/comment/635/
    >>
    >>Using that as a base add this code. Then once the Connect routine has been
    >>run try selecting a slicing and doubleclicking it.
    >>
    >>Private Sub Cht_BeforeDoubleClick(ByVal ElementID As Long, _
    >> ByVal Arg1 As Long, ByVal Arg2 As Long, Cancel As Boolean)
    >>
    >> If ElementID = xlSeries Then
    >> If Arg2 > 0 Then
    >> MsgBox "Run a macro for Slice " & Arg2
    >> Cancel = True
    >> End If
    >> End If
    >>End Sub
    >>
    >>Cheers
    >>Andy
    >>
    >>Mark Stephens wrote:
    >>
    >>>I want to do a 3D pie chart embedded in a work sheet and allow each piece
    >>>if the pie to be 'clickable' i.e run a designated macro when clicked.
    >>>
    >>>One way that occurs to me (but hard in itself) would be to put an
    >>>invisible cover (autoshape) over the piece and then assign the macro to
    >>>it; but how would I go about matching its size and shape to the correct
    >>>dimension and position of the pie peice?
    >>>
    >>>Another compromise (if as I think my ideal way is impossible) would be to
    >>>try and detect the label position (less variable than the pie piece and a
    >>>convenient rectangle) and then place an invisible cover over the label
    >>>and then assign the macro with and 'on action' command.
    >>>
    >>>There's usually a way of achieveing most anything but this seems to be a
    >>>tough one, any suggestions appreciated.
    >>>
    >>>Kind regards, Mark Stephens

    >>
    >>--
    >>
    >>Andy Pope, Microsoft MVP - Excel
    >>http://www.andypope.info

    >
    >
    >



+ 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