+ Reply to Thread
Results 1 to 8 of 8

How to plot Stock Chart and Bar graphs (for volume) instead of Line graphs on same chart?

  1. #1
    Registered User
    Join Date
    03-22-2021
    Location
    Kokomo, Indiana
    MS-Off Ver
    365
    Posts
    6

    How to plot Stock Chart and Bar graphs (for volume) instead of Line graphs on same chart?

    Hello. I've been attempting to plot volume (as columns on a secondary axis) below a Open-Hi-Low-Close stock chart without success. The best I'm able to do is plot volume as a line graph. Can anyone tell me how I can plot volume in a column rather than a line? Attached is a abbreviated sample sheet. I'm using Excel 365 under Win7.

    If I right click on the chart and select Format Plot Area and then select "Volume" under the Plot Area Options drop down menu, all the options are for Line graphs. Right clicking on the chart and choosing Change Chart Type > All Charts I see this chart is a Combo > Custom Combination. Under "Choose the chart type and axis for your data series" All my series are blank for their chart type. For the series "Volume" it's blank and the Secondary Axis is checked. If I try to change the Chart Type for Volume, it doesn't seem to take. I can change to "Clustered Column" and it doesn't change anything.

    Can anyone tell me how I can change my Volume plot from a line to a column? Thanks for any help!
    Attached Files Attached Files

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

    Re: How to plot Stock Chart and Bar graphs (for volume) instead of Line graphs on same cha

    After about a day, I will venture to respond, though I don't know that I have a solution.

    In my version of Excel (2007), I can create a stock volume open high low close chart that allows me to switch the volume series between line and column chart with no difficulty. When I create the chart in my version, Excel insists that the data be arranged in order from left to right date - volume - open - high - low - close, so I needed to make copies of those columns off to the side in that order. I could then use autofilter (https://www.wikihow.com/Use-AutoFilter-in-MS-Excel ) on that table/chart to show a specific date range as desired. This obviously operates very differently from your "enter dates into cells and then have dynamic named ranges for the different chart series". I could not really get anything to work with those dynamic named ranges, but that could be my own inexperience with dynamic named ranges.

    I do know that many of these "specialty charts" are very inflexible. When you deviate too much from what the specialty chart expects (perhaps these named ranges are too large of a deviation?), then the chart has problems. Most (if not all) specialty charts can be created as "regular" charts if you know the procedure (see here for a waterfall chart example: https://peltiertech.com/excel-waterf...bridge-charts/ ). It often takes more work up front to create these specialty charts as regular charts, but the main advantage is that we retain all the flexibility that comes from using regular charts. In your example, I:

    1) Select the chart and change the chart to a line chart (I chose marker and line subtype so I can see each data series clearly). I'm going to use up down bars as shown in the waterfall chart example, which is why I chose a line chart type. I get a basic line chart with all series on one primary axis (so the volume series dwarfs everything else).
    2) Move the volume series to the secondary axis and change to column chart so I now have a line + column combination chart.
    3) I am going to use up down bars (similar to the waterfall chart example), so I delete the low and high data series from the chart (they will be added back in as error bars later).
    4) Select one of the two line chart series and add up/down bars.
    5) Select the Open data series -> add error bars -> custom value -> use Data!AE2:AE30 for the positive error value and Data!AF2:AF30 for the negative error value. These cells are currently empty, so nothing shows up, but we'll fix that.
    6) Go to Data!AE2 and enter the formula =ABS($B2-C2). Copy/paste/fill into AE2:AF30.
    7) While here, enter the formula for the moving average trendline. In Data!AG10 (9th row down) =AVERAGE(D2:D10) (note the relative references). Copy/paste/fill into AG10:AG30.
    8) Select AG2:AG30 -> Copy -> Select the Chart -> paste and the moving average trendline is added. Note that Excel decides to move the up down bars. It appears that Excel wants to connect the first and last line chart series with the up down bars, so change the order of the data series (edit the last argument of the SERIES() "formula" or change the order in the select data dialog) so that the moving average series is between the open and close series. The up down bars should move back to being between the open and close series.
    9) Format chart elements as desired.

    That should be real close to what you started with, but with the ability to choose either column or line for the volume series. You may need to test it to see if you need to come up with dynamic named ranges for the error bar values and/or the moving average data series, but this should be able to work as a regular line + column combination chart without the restrictions that come from using the stock specialty chart.
    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
    03-22-2021
    Location
    Kokomo, Indiana
    MS-Off Ver
    365
    Posts
    6

    Re: How to plot Stock Chart and Bar graphs (for volume) instead of Line graphs on same cha

    MrShorty - thanks for the detailed reply! I think both my problems I'm having with Excel charts stem from using their built-in Stock charts although the strange thing is that I think after a lot of messing around with it I've lost some of the stock features and my Excel file seems to be messed up. For example, when I go to Change Chart Type my chart is a Combo type, not a Stock type although it did start as a Stock type and I've no idea how that got changed.

    Anyway, I'm trying to follow your directions for creating my own stock type chart using another sample file and I'm having problems at step 5. I don't see "Open data series" to add error bars. I can only go to Chart Tools > Add Chart Element > Error Bars which doesn't give me an option of doing custom value and indicating a data range as you suggest. I'm using Excel 365 if that matters?

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

    Re: How to plot Stock Chart and Bar graphs (for volume) instead of Line graphs on same cha

    The only reason 365 would matter is that I won't know where to find all of these commands, but I expect all of the commands I use to still be available somewhere in the O365 user interface.

    In my version doing step 5, I can click on the "open" (or "series1" or "series2" or whatever you have named the series corresponding to the Open data in the spreadsheet) data series to select it, or I can use the dropdown list of available chart elements in the format ribbon/menu. Once I have selected the data series, then use the Chart Tools > Add Chart Element > Error Bars. If there is no "error bar options" at this point, add the error bars with whatever options Excel chooses by default, then select the newly added error bars and find the "format error bars" dialog where you should be able to find different options (including a custom option) for the error bar values.

  5. #5
    Registered User
    Join Date
    03-22-2021
    Location
    Kokomo, Indiana
    MS-Off Ver
    365
    Posts
    6

    Re: How to plot Stock Chart and Bar graphs (for volume) instead of Line graphs on same cha

    Thanks again for the help. I worked through most of your suggestions on how to make my own stock charts but now I'm stuck on getting that moving average to plot nicely with the Up/Down bars. I did figure out some additions/changes to your instructions too. I'm not even worrying about adding the volume yet as making a line + column with a secondary axis should be the easy part so I'll just save that for last. Here's what I learned on how to make a stock chart from scratch:

    1. Make a simple line chart with just the Open and Close values and the date.
    2. Click on the chart to activate Chart Tools > Add Chart Elements > Add Up/Down Bars
    3. Very Important! Right Click in the chart and choose Format Plot Area, Click on the "Open" series and choose "No Line" to get rid of the line and only leave the Up/Down bars.
    4. Do the same for the "Close" series.
    5. Click on the chart to activate Chart Tools > Add Chart Elements > Add Error Bars. Choose any type because you'll be changing it.
    6. Make a new column in your data (example: Data!AE2 and enter the formula =ABS($B2-C2) where B is the Open & C is the High & D is the Low and Copy/paste/fill into AE2:AF30.
    7. So now AE contains the Positive Error ($B-C Open-High) and AF contains the Negative Error ($B-D Open-Low), both calculated off the Open price.
    8. Right Click in the chart and choose Format Plot Area, Click on the series "Open" Y Error Bars, Click on the 3 bar icon under Error Bar Options, under Error Amount choose Custom and click Specify Value and input your Positive and Negative Error range (columns AE and AF in our example). Click on the Paint Bucket Icon, under Line choose Automatic, under the 3 column icon > Vertical Error Bar choose Both Directions.
    9. Right Click in the chart and choose Format Plot Area, Click on the series "Close" Y Error Bars, Click on the paint bucket icon under Error Bar Options, Choose No Line under Line because the error bars are calculated from the Open price and not the Close price. This is important because if you don't choose No Line you'll have 2 sets of Error Bars.

    The above gives me a nice Open-High-Low-Close chart. Now I'm having problems adding in the Moving Average line. Mr.Shorty suggested:

    7) While here, enter the formula for the moving average trendline. In Data!AG10 (9th row down) =AVERAGE(D2:D10) (note the relative references). Copy/paste/fill into AG10:AG30.
    8) Select AG2:AG30 -> Copy -> Select the Chart -> paste and the moving average trendline is added. Note that Excel decides to move the up down bars. It appears that Excel wants to connect the first and last line chart series with the up down bars, so change the order of the data series (edit the last argument of the SERIES() "formula" or change the order in the select data dialog) so that the moving average series is between the open and close series. The up down bars should move back to being between the open and close series.

    The critical statement is here: "It appears that Excel wants to connect the first and last line chart series with the up down bars," The problem is, sometimes the MA contains values that are not simply between the High/Low daily price, often the MA values are below or above, so no matter how I position the order of my series in the Select Data dialog if my MA is outside my high/low bounds the up/down bars want to incorporate it. I've searched the internet but don't find any way to make a Up/Down bar just for a select 2 line series and have other line series (the MAs) be separated from the Up/Down pair?

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

    Re: How to plot Stock Chart and Bar graphs (for volume) instead of Line graphs on same cha

    I'm not sure why yours comes out differently than mine. Here's a file I put together (picture of final chart to show what mine looked like at the end) following your steps (and then adding the volume series). In the end, the up down bars were between the open and close series, moving average seemed higher than the stock chart's moving average trendline. Other than that (and some minor formatting), the two charts look very similar. What do you see when you open my file in your version of Excel?
    Attached Images Attached Images
    Attached Files Attached Files

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

    Re: How to plot Stock Chart and Bar graphs (for volume) instead of Line graphs on same cha

    If you continue to have trouble with the "up down bars on a line chart" approach, I will note the the other common approach to getting these "floating bars" is to build the chart as a stacked column chart. I don't know if you looked at the waterfall chart tutorial, but Peltier describes this approach as well. You can also look around for "box and whisker plot" tutorials that will show a similar stacked column/bar approach to this sort of thing. It will require more ancillary data in the spreadsheet than the line chart with up/down bars approach, but I would not expect to have the same problem with Excel randomly choosing which data series to connect the up/down bars to.

  8. #8
    Registered User
    Join Date
    03-22-2021
    Location
    Kokomo, Indiana
    MS-Off Ver
    365
    Posts
    6

    Re: How to plot Stock Chart and Bar graphs (for volume) instead of Line graphs on same cha

    MrShorty - Thanks for attaching your sample file - using it I finally got mine working too. After much studying I realized you only had an Open & Close data series in your chart while I actually had 4 - Open, High, Low & Close - although I had High & Low unchecked (thus not displayed), they still existed. So when we both created a MA and changed the order in the select data dialog to put the MA between the open & close, I actually had a High & Low series in there between the open & close as well. Once I deleted the High & Low (since we don't really need them as your method uses the error bars in their place) and placed the MA between the Open & Close it worked and I got the same results as you do.

    I still don't understand why that select data dialog order makes it work or why having a High & Low in there messes it up, but thanks for all the help! It's much appreciated!

+ 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. [SOLVED] Creating a combo Stock-Candlestick chart & Line Chart
    By ExcelBoy90 in forum Excel Charting & Pivots
    Replies: 14
    Last Post: 12-25-2019, 02:01 AM
  2. Unable to chart two line graphs on the same secondary axis?
    By Cowboys9 in forum Excel Charting & Pivots
    Replies: 3
    Last Post: 05-23-2017, 03:00 PM
  3. 2 Line Graphs from different years on one chart?
    By nobodyukno in forum Excel General
    Replies: 1
    Last Post: 02-16-2017, 11:14 AM
  4. Replies: 1
    Last Post: 06-15-2013, 02:48 AM
  5. Multiple Plot Shading in Line Graphs
    By ask72883 in forum Excel Charting & Pivots
    Replies: 1
    Last Post: 05-15-2006, 02:35 PM
  6. Line Graphs - How do I plot N/As?
    By duncanm in forum Excel Charting & Pivots
    Replies: 1
    Last Post: 09-15-2005, 02:05 PM
  7. Replies: 2
    Last Post: 08-12-2005, 08:05 AM

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