+ Reply to Thread
Results 1 to 9 of 9

Plotting directional arrows on an excel graph

  1. #1
    Registered User
    Join Date
    02-14-2017
    Location
    Gibraltar
    MS-Off Ver
    2016
    Posts
    4

    Plotting directional arrows on an excel graph

    Hi,

    I wondered if anyone could help. I'd like to plot some marine data - wave heights and direction on a chart. I have seen examples and managed to do some conditional formatting to read the direction originally in degrees and assign it N, S, SW etc. But what I want to do is to have the wave heights plotted as a line graph with the corresponding directional arrows on the same graph above. I believe this has to be using icon sets or with some VBA?

    I would appreciate any help please.

    Many thanks

    Steph

  2. #2
    Valued Forum Contributor luv2glyd's Avatar
    Join Date
    07-13-2008
    Location
    Seattle, WA, US
    MS-Off Ver
    Excel 2010
    Posts
    679

    Re: Plotting directional arrows on an excel graph

    Hi Steph. Welcome to the forum. Have you ever dealt with VBA in excel? If not, for what you need to do here, you don't need to know much just patience in understanding what each line of code means. I'd also do some searches on how a "for loop" works in VBA.

    Here's what I got from just recording a simple macro and modifying it slightly to accommodate a loop. You'll have to create a picture file for each direction that you want to use.

    Let me know if you have any trouble.

    This is a slightly more compact code than what's in the attachment, but it does exactly the same thing.

    Please Login or Register  to view this content.
    Attached Files Attached Files
    Last edited by luv2glyd; 02-14-2017 at 04:01 PM.
    You either quit or become really good at it. There are no other choices.

  3. #3
    Registered User
    Join Date
    02-14-2017
    Location
    Gibraltar
    MS-Off Ver
    2016
    Posts
    4

    Re: Plotting directional arrows on an excel graph

    Hi,

    I had a look at what you gave me but can't fathom it out - I think I'm lost :-(

  4. #4
    Valued Forum Contributor luv2glyd's Avatar
    Join Date
    07-13-2008
    Location
    Seattle, WA, US
    MS-Off Ver
    Excel 2010
    Posts
    679

    Re: Plotting directional arrows on an excel graph

    Lol. What part is not clear specifically?

  5. #5
    Registered User
    Join Date
    02-14-2017
    Location
    Gibraltar
    MS-Off Ver
    2016
    Posts
    4

    Re: Plotting directional arrows on an excel graph

    All of it haha. I was trying to work out the code from the shortened version you added but can't see how I would define the datapoints to put in the arrows. Sorry :-)

  6. #6
    Valued Forum Contributor luv2glyd's Avatar
    Join Date
    07-13-2008
    Location
    Seattle, WA, US
    MS-Off Ver
    Excel 2010
    Posts
    679

    Re: Plotting directional arrows on an excel graph

    The code basically goes through each data point you have set up in excel in column A and determines what wind direction a particular cell shows. This is the "For data_point = 1 To 8" loop where 8 can be extended to any number you wish (the number of our data points, so it could be 100 if you want).

    Then with "If .... Then .... ElseIf .... End If" portion, it checks to see if the direction is "N" (for North) for example, then it would pull out a picture file depicting an arrow pointing up (you have to create this picture yourself). The address of this picture file is C:\Program Files (x86)\Microsoft Office\MEDIA\CAGCAT10\j0149407.wmf on my PC, but you can put it anywhere you want it in yours and just paste in the link and file name into code.

    If direction is not "N", it goes to the next iteration and checks if direction is "S", if not, checks if direction is "E" and so on.

    Once it finds the picture file for that particular point, it feeds it into the chart, and the goes on to the next point and looks for it's picture file. This is how a "For" loop works.

    Welcome to VBA programming It's not that complicated once you really get into it. I started off playing around recording macros and tweaking them, and now can write many pages of code in a day for what I need to do.
    Last edited by luv2glyd; 02-15-2017 at 06:18 PM.

  7. #7
    Registered User
    Join Date
    02-14-2017
    Location
    Gibraltar
    MS-Off Ver
    2016
    Posts
    4

    Re: Plotting directional arrows on an excel graph

    Hi,

    I'll try and take another look at it. Didn't know what you meant by setting up a data point and not sure how you record the macro and where, obviously you're talking to a real novice here with this aspect of Excel ;-) Hey if you're really good at this let me know as I've been thinking of finding a freelancer to set it up for me if I fail - which seems quite likely haha.

    Thanks as always for the above.

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

    Re: Plotting directional arrows on an excel graph

    No need for vba. Just use some additional series and formula.
    Attached Files Attached Files
    Cheers
    Andy
    www.andypope.info

  9. #9
    Valued Forum Contributor luv2glyd's Avatar
    Join Date
    07-13-2008
    Location
    Seattle, WA, US
    MS-Off Ver
    Excel 2010
    Posts
    679

    Re: Plotting directional arrows on an excel graph

    Quote Originally Posted by Andy Pope View Post
    No need for vba. Just use some additional series and formula.
    Wow. Had no idea those symbols existed. That's the way to go.

+ 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. Using Excel as Grapher (graph plotting)?
    By Meeraan in forum Excel Charting & Pivots
    Replies: 1
    Last Post: 08-13-2014, 02:52 AM
  2. Plotting graph excel VBA
    By blh in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-10-2014, 12:03 PM
  3. Plotting graph excel VBA
    By blh in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-07-2014, 10:52 AM
  4. [SOLVED] Plotting a standard bar graph on the same axes as a stacked bar graph
    By Shearwater in forum Excel Charting & Pivots
    Replies: 4
    Last Post: 05-01-2014, 04:59 AM
  5. Paste directional arrows based on cell value
    By lukebarnett in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-11-2012, 09:55 AM
  6. Excel Graph Plotting
    By callsaravananr in forum Excel General
    Replies: 4
    Last Post: 07-12-2009, 12:28 PM
  7. How do I set up a Speed and directional graph
    By houndman in forum Excel Charting & Pivots
    Replies: 0
    Last Post: 07-02-2006, 10:15 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