+ Reply to Thread
Results 1 to 7 of 7

Add Horizontal line to stock chart

  1. #1
    Registered User
    Join Date
    02-23-2011
    Location
    USA
    MS-Off Ver
    Excel 2007
    Posts
    3

    Add Horizontal line to stock chart

    Hi,

    I am using the the stock chart and I would like there to be a horizontal line across the chart with a y-axis of the opening price. In the end I want this to be in VBA but I think if someone can show how to do this manually I should be able to put it in loop of data that will produce many charts with a horizontal line starting at the day opening.

    I have tried to add a new series to the chart but I'm using the Candle stick stock chart and the new series comes out as a vertical not horizontal line. I read about using a secondary horizontal axis but all the tutorials I find are in Excel 2003 and they donlt line up well with Excel 2007.

    Any thoughts on how this is done?

    I found this link on charts with horizontal lines but again they are in 2003 and I'm using a candle stick stock chart not a scatter chart.
    http://www.tushar-mehta.com/excel/ch...traight_lines/

    Thanks,
    4dplane

  2. #2
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,718

    Re: Add Horizontal line to stock chart

    The stock chart is hi-lo-close for a series of days, but you refer to the "day opening." Do you mean that you want a horizontal line for the value of the opening of the first day?

    A stock chart cannot be combined with other types of charts (the example in your link show two types that can be combined).

    One workaround is to create two charts, then make the background on one transparent and overlay on the other chart. Crude but effective.
    Jeff
    | | |會 |會 |會 |會 | |:| | |會 |會
    Read the rules
    Use code tags to [code]enclose your code![/code]

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

    Re: Add Horizontal line to stock chart

    Instructions are in attached file.
    Attached Files Attached Files
    Cheers
    Andy
    www.andypope.info

  4. #4
    Registered User
    Join Date
    02-23-2011
    Location
    USA
    MS-Off Ver
    Excel 2007
    Posts
    3

    Re: Add Horizontal line to stock chart

    Thanks to you both... Andy your file example was A+.

    In the ended, I used two graphs on top of each other reason being is I want many lines not just the one.

    Thanks,
    4D

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

    Re: Add Horizontal line to stock chart

    I was able to add 251 lines. How many exactly did you want?

  6. #6
    Registered User
    Join Date
    12-19-2012
    Location
    Saint Marys, PA
    MS-Off Ver
    Excel 2010
    Posts
    2

    Re: Add Horizontal line to stock chart

    Quote Originally Posted by Andy Pope View Post
    Instructions are in attached file.
    In the Excel file example, the third line of instruction is, "Select Horizontal Line series and move to secondary axis." What is the secondary axis? How do I do this?
    Last edited by mgroll77; 12-19-2012 at 03:53 PM.

  7. #7
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,718

    Re: Add Horizontal line to stock chart

    I hate it when I say something can't be done and Andy does it.

    Anyway, you will see in the third and fourth chart to the right in the example file that there is a y-axis on the left, and a y-axis on the right. The y-axis on the right is known as the secondary axis. You can have some data series that are plotted on the primary axis, and other data series that are plotted using the secondary axis. To move the line to be plotted on the secondary axis:

    1. Right-click on the blue line to select it
    2. Select Format Data Series from the pop-up menu
    3. Select Series Options from the left
    4. Click on Secondary Axis on the right

+ 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