Results 1 to 8 of 8

Thread: [RESOLVED] Excel - combo chart scatter and column!

  1. #1

    Thread Starter
    Fanatic Member VBAhack's Avatar
    Join Date
    Dec 2004
    Location
    Sector 000
    Posts
    617

    Resolved [RESOLVED] Excel - combo chart scatter and column!

    Anybody know how to make a combo scatter + column chart so the x-values line up?

    The fundamental problem is that a column chart behaves like a "line" chart in that the x-axis corresponds to labels instead of values. If the x-values of the scatter plot are linear, everyting lines up nicely, but in that case there is no reason to have a scatter plot in the first place. If the x-values are not linear the plots don't line up (see attached example where I want each column to line up horizontally with the corresponding data point but clearly doesn't).

    Is there some trick to make this work or have I encountered an Excel limitation w/o workaround?

    My actual situation is more complex, but the attached illustrates the issue. My data is such that I can't use a line plot, must have a scatter plot.
    Attached Images Attached Images  
    Last edited by VBAhack; Apr 30th, 2014 at 07:44 PM.

  2. #2
    Don't Panic! Ecniv's Avatar
    Join Date
    Nov 2000
    Location
    Amsterdam...
    Posts
    5,343

    Re: Excel - combo chart scatter and column!

    Doing in code?
    I added the X axis to each series (same range). Not sure if that will solve your problem.

    I do have a different problem with graphs, but I'll post that in another thread.

    srs is a series (object)
    sht is the sheet with the data
    rng is a range object

    Code:
        Set rng = sht.Range(sht.cells(1, 2), sht.cells(1, 10)) ' b1 - J1
        strCell = "'" & sht.Name & "'!" & rng.addresslocal(True, True)
        srs.XValues = "=" & strCell 'needs a series to add the xvalues to...

    BOFH Now, BOFH Past, Information on duplicates

    Feeling like a fly on the inside of a closed window (Thunk!)
    If I post a lot, it is because I am bored at work! ;D Or stuck...
    * Anything I post can be only my opinion. Advice etc is up to you to persue...

  3. #3
    Addicted Member 3com's Avatar
    Join Date
    Jul 2013
    Location
    Spain
    Posts
    253

    Re: Excel - combo chart scatter and column!


  4. #4

    Thread Starter
    Fanatic Member VBAhack's Avatar
    Join Date
    Dec 2004
    Location
    Sector 000
    Posts
    617

    Re: Excel - combo chart scatter and column!

    Thanks for your replies. Yep, already have the same x-axis values for each series. Also, already saw that link. Every example I've seen combining scatter with column has linear data for the scatter x-axis (meaning scatter isn't needed). I'm all but convinced it can't be done (fundamental incompatability between scatter and column). Works OK if I use scatter for both series but I really need columns for the 2nd series. Disappointing.....

  5. #5
    Don't Panic! Ecniv's Avatar
    Join Date
    Nov 2000
    Location
    Amsterdam...
    Posts
    5,343

    Re: Excel - combo chart scatter and column!

    Hi

    I tried some duff data...

    Name:  tp.jpg
Views: 3679
Size:  24.6 KB


    Was this what is was meant to do ?

    BOFH Now, BOFH Past, Information on duplicates

    Feeling like a fly on the inside of a closed window (Thunk!)
    If I post a lot, it is because I am bored at work! ;D Or stuck...
    * Anything I post can be only my opinion. Advice etc is up to you to persue...

  6. #6

    Thread Starter
    Fanatic Member VBAhack's Avatar
    Join Date
    Dec 2004
    Location
    Sector 000
    Posts
    617

    Re: Excel - combo chart scatter and column!

    Nope. The attached illustrates. I want to use the exact same data (x and y values) for both series. In the left plot, everything lines up but the x-values aren't scaled properly (because I used a line-chart instead of scatter). In the right one, the scatter x-values are scaled properly but the column data is not (treats the x-values as a linear label rather than actual values). What I'm really looking for is a column chart with properly scaled x-values. Doesn't seem to exist.
    Attached Images Attached Images  

  7. #7
    PowerPoster
    Join Date
    Oct 2008
    Location
    Midwest Region, United States
    Posts
    3,574

    Re: Excel - combo chart scatter and column!

    Ok, so maybe we need to "hack" this, then...Can we "tie the values together" via code, then graph then, maybe? Does that make sense?

  8. #8

    Thread Starter
    Fanatic Member VBAhack's Avatar
    Join Date
    Dec 2004
    Location
    Sector 000
    Posts
    617

    Re: Excel - combo chart scatter and column!

    Found a hack elsewhere by making the 2nd series a scatter plot and adding vertical error bars (100% negative and 0% positive). Thus, the columns are really negative vertical error bars. That makes the legend goofy but I just pasted in a graphic rectangle to make it look right. Total hack but it seems to do the job. Still can't understand why there is no inherent ability in Excel to make such a column chart.........
    Attached Images Attached Images  

Posting Permissions

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



Click Here to Expand Forum to Full Width