+ Reply to Thread
Results 1 to 2 of 2

Plotting series names as numerical values in a scatter graph?

Hybrid View

  1. #1
    Registered User
    Join Date
    12-09-2010
    Location
    London, England
    MS-Off Ver
    Excel 2007
    Posts
    21

    Plotting series names as numerical values in a scatter graph?

    Hi all,

    So I have three columns of data;

    a list of names in column one that I want to be the name of my data series

    numerical value 1

    numerical value 2

    I want to plot numerical value 2 agianst numerical value 3, instead it plots 2 and 3 as separate series.

    I appreciate the explanation above isn't too clear, so I've attached a spreadsheet that models the issue. Graph 1 is on the right, Graph 2 on the left.

    Thanks in advance.
    Attached Files Attached Files

  2. #2
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,481

    Re: Plotting series names as numerical values in a scatter graph?

    The quickest way is with code

    Sub XX()
    
        Dim rngData As Range
        Dim rngItem As Range
        Dim chtTemp As Chart
        
        Set rngData = Range("A2:C9")
        Set chtTemp = Sheet1.Shapes.AddChart(xlXYScatter, 50, 400, 400, 250).Chart
        
        Do While chtTemp.SeriesCollection.Count > 0
            chtTemp.SeriesCollection(1).Delete
        Loop
        
        For Each rngItem In rngData.Rows
            With chtTemp.SeriesCollection.NewSeries
                .Name = rngItem.Cells(1, 1)
                .XValues = rngItem.Cells(1, 2)
                .Values = rngItem.Cells(1, 3)
            End With
        Next
    End Sub
    Manually you would need to use the Select Data dialog to add and set correct references to each series requried.
    Cheers
    Andy
    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