+ Reply to Thread
Results 1 to 3 of 3

Programmatically creating chart with hour value on X-axis but not plotted as a series

  1. #1
    Registered User
    Join Date
    04-16-2009
    Location
    Kilkenny, Ireland.
    MS-Off Ver
    Excel 365
    Posts
    47

    Programmatically creating chart with hour value on X-axis but not plotted as a series

    Hi, I'm a bit stumped by the following and was hoping somebody could help.

    I'm looking to programmatically create a chart of the type shown on top in the attached image.

    That is with the hours from 0 to 23 showing on the x-axis but not plotted as such.

    When I try to create this programmatically using the code below the chart showing on the bottom is being produced.

    Here's the simple code I am using:

    Please Login or Register  to view this content.
    Same chart data range for both charts is showing in 'Select Data'. Both obviously xlLine charts.

    The 2nd chart obviously has the 2nd series that I do not need. If I remove this series, the x-axis value continue to plot from 1 to 24

    I'm probably missing something obvious but I cannot find what it is.

    Thanks in advance for any advice.
    Orson.
    Attached Images Attached Images

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

    Re: Programmatically creating chart with hour value on X-axis but not plotted as a series

    Try this revised code to add a new series to the chart.

    Please Login or Register  to view this content.
    Cheers
    Andy
    www.andypope.info

  3. #3
    Registered User
    Join Date
    04-16-2009
    Location
    Kilkenny, Ireland.
    MS-Off Ver
    Excel 365
    Posts
    47

    Re: Programmatically creating chart with hour value on X-axis but not plotted as a series

    Hi Andy, many thanks for the impressively fast response

    I see what you've done there and many thanks for that, I will gladly pinch it on you.

    I do find it rather strange that there does not appear to be any programmatical distinction that you can specify on initial creation of chart to ensure you get the version you want.

    Rather, you're obliged to make these post-creation changes.

    I've reviewed the macro recorder output for a differentiator when I select both of these chart options in the GUI in turn and I can't see anything there.

    Thanks again, this will allow me to get on with things now, will have to re-purpose for other sheet requirements also.

    Rgds
    Orson.

+ 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. How to order chart series when plotted on primary and secondary axis
    By Colin_in_Belgium in forum Excel Charting & Pivots
    Replies: 4
    Last Post: 03-11-2021, 08:42 AM
  2. Replies: 3
    Last Post: 04-09-2018, 10:42 AM
  3. Replies: 5
    Last Post: 01-07-2017, 03:17 PM
  4. Replies: 2
    Last Post: 03-17-2014, 07:58 AM
  5. Area chart reverse fills when plotted on a secondary x-axis.
    By mrscut in forum Excel Charting & Pivots
    Replies: 1
    Last Post: 07-03-2013, 04:38 AM
  6. Ensure Sensible Axis Scale When Creating Graphs Programmatically
    By chergh in forum Excel Charting & Pivots
    Replies: 8
    Last Post: 01-15-2010, 10:44 AM
  7. Hiding a non-plotted chart series in legend
    By Gromit in forum Excel General
    Replies: 0
    Last Post: 01-12-2006, 05:42 PM

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.6.0 RC 1