+ Reply to Thread
Results 1 to 6 of 6

Changing x axis type to "date" when it contains data from 2 columns

  1. #1
    Registered User
    Join Date
    04-15-2016
    Location
    Singapore
    MS-Off Ver
    2010, 2013
    Posts
    13

    Changing x axis type to "date" when it contains data from 2 columns

    Hi,

    I have a line/bar graph with an X-axis made up of 2 different columns - a "date" and a "type". This makes it easy for me to tell what type the bars and lines correspond to, which is great. However, I wish to format the axis as a date so that the data points are proportional to the date on the axis. I'm unable to do so as this option is greyed out.

    If I remove the "type" column from the chart data area, then it automatically recognizes the dates and plots the data points proportionally on the axis. However, it also includes fills in the axis with dates that are not in my data. My x-axis consists of discrete events that I wish to plot rather than a continuous one.

    How can I do this?
    Last edited by galapogos; 03-21-2017 at 03:35 AM.

  2. #2
    Forum Guru
    Join Date
    04-13-2005
    Location
    North America
    MS-Off Ver
    2002/XP and 2007
    Posts
    15,827

    Re: Changing x axis type to "date" when it contains data from 2 columns

    I would suggest that you provide a better example (an Excel file uploaded to the forum would be ideal) of what you have tried along with your explanation of what you want. I am having difficulty visualizing what you want.

    Your observation that date and multi-level category axes do not work together is correct. If I understand what you are trying to do here, one would usually "hide" the real axis (format as no line, no marker, no label), then add a "dummy" series containing the desired points, and format that second series so it looks like the axis. The basic technique is illustrated here http://peltiertech.com/reciprocal-chart-axis-scale/ for a "reciprocal" axis on a scatter chart, but the technique should readily adapt to a line chart with a date axis.
    Quote Originally Posted by shg
    Mathematics is the native language of the natural world. Just trying to become literate.

  3. #3
    Registered User
    Join Date
    04-15-2016
    Location
    Singapore
    MS-Off Ver
    2010, 2013
    Posts
    13

    Re: Changing x axis type to "date" when it contains data from 2 columns

    Sorry, here's a screenshot of the data and chart:
    Untitled.png
    As you can see, I can easily tell if each group of bars (and corresponding point in the line graph) is a type 1 or type 2. That's great. However, as you can see from the data, there are a lot more events from 2009-2010 than there are from more recent years, and in the chart, I don't get a sense of proportion in that, so the line graph looks like it's increasing faster than it is.

    Hope that's clearer.

  4. #4
    Forum Guru
    Join Date
    04-13-2005
    Location
    North America
    MS-Off Ver
    2002/XP and 2007
    Posts
    15,827

    Re: Changing x axis type to "date" when it contains data from 2 columns

    It is clearer, though we cannot do much with a screenshot other than look at it.

    As I suggested, and as you have already seen, in order to get a date axis, you need to get rid of the "multi-level" horizontal axis -- which means that your horizontal axis data can only be based on column A. You will need to figure out a different strategy for identifying the Type 1 and Type 2.

    One strategy might be to use column A for the horizontal axis data, columns D, F, H (G must be hidden) for the column chart data, then use data labels to identify the Type 1 and 2 (https://support.office.com/en-us/art...2-f467c9f4eb2d ).

    Another strategy might be to change the format for the type 1 and/or type 2 columns so that the color/fill pattern/?? will be used to identify type 1 and type 2. This is probably most easily accomplished using "conditional formatting" of charts (which is mostly done in the spreadsheet, not the chart): http://peltiertech.com/conditional-f...-excel-charts/

    I would probably pick one of those two strategies and work with that.

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

    Re: Changing x axis type to "date" when it contains data from 2 columns

    You can add 2 dummy series and use the data label to provide the type.

    Although the date axis provides the proportion spacing it means it get very condensed around actual data points.
    Attached Files Attached Files
    Cheers
    Andy
    www.andypope.info

  6. #6
    Registered User
    Join Date
    04-15-2016
    Location
    Singapore
    MS-Off Ver
    2010, 2013
    Posts
    13

    Re: Changing x axis type to "date" when it contains data from 2 columns

    Thanks Andy and MrShorty!

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Replies: 1
    Last Post: 01-22-2016, 09:21 AM
  2. Replies: 0
    Last Post: 11-22-2013, 01:36 PM
  3. Replies: 0
    Last Post: 01-09-2013, 06:52 PM
  4. Excel 2010 (Run-time error '13' type mismatch) "Debug" and "Continue" Grayed out.
    By Jeronimo in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 12-18-2012, 06:42 PM
  5. [SOLVED] Problem creating Line Chart from columns "date" and "money"
    By brosef in forum Excel Charting & Pivots
    Replies: 7
    Last Post: 11-05-2012, 09:01 AM
  6. [SOLVED] Separating Binary Numbers via "Text to Columns" Type Approach
    By JP777 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 04-22-2012, 09:19 AM
  7. [SOLVED] Where is the toolbar with the "bold type", "font type", options
    By fwccbcc in forum Excel - New Users/Basics
    Replies: 2
    Last Post: 05-03-2006, 04:15 PM

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