+ Reply to Thread
Results 1 to 13 of 13

Thread: XY Scatter Graph

  1. #1
    Registered User
    Join Date
    04-30-2009
    Location
    milton keynes, uk
    MS-Off Ver
    Excel 2003
    Posts
    21

    Unhappy XY Scatter Graph

    Hi all,

    I am working on a XL Scatter Graph that will automatically update as changes are made to the data. I would appreciate any help with this query.

    There are three columns of data, with headers: "item name", "cost", "impact". Each "item name" is the legend or data label of the graph. "cost" is the x axis. "impact" is the y axis.

    So, for each "item name", a point will appear on the graph showing the items cost and impact. If any chages are made to either its cost, or impact, the graph will automatically update.

    Now, there might be five items that are shown on the graph. If I add a new item to my data it will not appear on the graph, unless I go into the source data, and add a new series.

    Is there a way that new items can appear on the graph automatically?

    Many thanks, Tom.
    Last edited by strongarmtom; 05-01-2009 at 08:53 AM.

  2. #2
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    2003 & 2007 & 2010
    Posts
    11,349

    Re: XY Scatter Graph

    Adding new series to a chart is best done via code.

    If you did not have the complication of naming each point with text you could have used a single series and a named range formula.
    Cheers
    Andy
    www.andypope.info

  3. #3
    Registered User
    Join Date
    04-30-2009
    Location
    milton keynes, uk
    MS-Off Ver
    Excel 2003
    Posts
    21

    Re: XY Scatter Graph

    thanks andy. unfortunately i do need the "complication of naming each point". i am familiar with vba code, but have never used it in relation to graphs before. is it possible to use code to create new data series? how can i do this?

  4. #4
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    2003 & 2007 & 2010
    Posts
    11,349

    Re: XY Scatter Graph

    Try this,

    It uses a listobject as the data source. Single series so data points will automatically appear.
    The code part simply updates the data label text to that of the information in the listobject
    Attached Files Attached Files
    Cheers
    Andy
    www.andypope.info

  5. #5
    Registered User
    Join Date
    04-30-2009
    Location
    milton keynes, uk
    MS-Off Ver
    Excel 2003
    Posts
    21

    Re: XY Scatter Graph

    hey andy, thanks again for your reply.

    how do i "add data to listobject"?

  6. #6
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    2003 & 2007 & 2010
    Posts
    11,349

    Re: XY Scatter Graph

    if you select a cell in the table you should see a blue border appear which will include a new records * marker.

    Or just type in the cell at the end of the list and it will expand
    Cheers
    Andy
    www.andypope.info

  7. #7
    Registered User
    Join Date
    04-30-2009
    Location
    milton keynes, uk
    MS-Off Ver
    Excel 2003
    Posts
    21

    Re: XY Scatter Graph

    hi,

    i'm having some problems here working this out...

    the graph looks identical to what i want, only it is minus the data labels.
    i can expand the table to include more items that will appear on the graph.

    but, how do i get the data labels to appear on the graph?
    if i add a new row to the data table, then click update chart, i get an error message that takes me to the vba editor. part of the sub: " Dim objListO As ListObject " is highlighted.

    sorry andy, i am fairly proficient on excel, but i've never worked that much with graphs before. if you could please explain what you mean in simple steps i would be much appreciated.

    thank you.

  8. #8
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    2003 & 2007 & 2010
    Posts
    11,349

    Re: XY Scatter Graph

    Sorry just noticed your using xl2000.

    Listobjects did not exist back them

    Here is the file with dynamic named ranges and the code adjusted for xl2000.
    Select chart and press button
    Attached Files Attached Files
    Cheers
    Andy
    www.andypope.info

  9. #9
    Registered User
    Join Date
    04-30-2009
    Location
    milton keynes, uk
    MS-Off Ver
    Excel 2003
    Posts
    21

    Re: XY Scatter Graph

    andy, that is awesome. i can't even believe that is possible. excel does some wonderful, wonderful things.

    thanks for your help mate. i will spend the next few days trying to understand what you have done.

    cheers!!

  10. #10
    Registered User
    Join Date
    04-30-2009
    Location
    milton keynes, uk
    MS-Off Ver
    Excel 2003
    Posts
    21

    Re: XY Scatter Graph

    hi andy, thanks for your help yesterday.

    i have one final question: what i need to do, is have the graph on a different sheet to the sheet that has the data.

    i have changed the location of the graph and it then produces an error. i have tried to amend the vba code and i also get an error. i think the code may be slightly over my head!!

    any further help would be appreciated. thanks.

  11. #11
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    2003 & 2007 & 2010
    Posts
    11,349

    Re: XY Scatter Graph

    I'm assuming the error is related to locating the range for the data.
    So something like this that specifies exactly which sheet to look on.

        Set rngData = Worksheets("Sheet1").Range("A1").CurrentRegion.Columns(1)
    Cheers
    Andy
    www.andypope.info

  12. #12
    Registered User
    Join Date
    04-30-2009
    Location
    milton keynes, uk
    MS-Off Ver
    Excel 2003
    Posts
    21

    Re: XY Scatter Graph

    ah ha. spot on once again. thanks andy.

  13. #13
    Registered User
    Join Date
    04-16-2012
    Location
    Oslo
    MS-Off Ver
    Excel 2007
    Posts
    1

    Re: XY Scatter Graph

    Quote Originally Posted by Andy Pope View Post
    Try this,

    It uses a listobject as the data source. Single series so data points will automatically appear.
    The code part simply updates the data label text to that of the information in the listobject
    Hi Andy,

    I stumbled across this after researching a solution to creating a dynamic xy chatterchart with labels.

    I tried to use your macro, but when i delete a row, the area of the graph does not move automatically, distorting the data. Is there a way to make it move up automatically, just as you have made it move down?
    I use Excel 2007.

    Thank you
    Last edited by ChristineMF; 04-16-2012 at 10:40 AM.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Tags for this Thread

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.2.0