+ Reply to Thread
Results 1 to 6 of 6

Creating a Triangle in a chart

  1. #1
    Registered User
    Join Date
    05-27-2008
    Posts
    25

    Creating a Triangle in a chart

    This is a bit long winded, so apologies in advance

    I'm trying to create a chart for a colleague that will show the results as a triangle (based on one of our company logo's). I've managed to come up with something by editing a Spider chart, but it's not enough! He wants the lines of the triangle to adjust in size depending on the actual data. For example, record 1 is 58%, record 2 is 29% and record 3 is 13%. The line for record 1 should be the longest, and record 3 the shortest. The results will change from month to month. I've attached an example, for what it's worth....
    Any help greatly appreciated, even if it's just someone telling me it can't be done!!

    Thanks

    Forgot to mention, I'm using Office 2003
    Attached Files Attached Files

  2. #2
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464
    Hi,

    Sound like one for Andy Pope!

    I'd just question why this radar chart rather than the more obvious pie chart. The radar chart plots lines relative to a central point. i.e. the distances of the lines from the central point are essentially your percentages. This of necessity means that the lengths of the lines are not the same proportion. I think you need some function to convert the percentages given, to distance percentages which will result in correct length lines.

    It should be possible with some simple geometry to work this out so I'll toss it around. One thing we don't know at the moment is what Excel regards as the centre of the triangle - presumably it's the line that bisects the angles.

    Rgds

  3. #3
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,481
    I tried manually to create the chart.

    I drew 3 lines of the same length then reduced the their widths by the percentages you gave.

    It is impossible to draw a triangle with those 3 lengths. So you would end up distorting the values in order to draw the shape.

    You can use xy-scatter to draw the 3 lines once you have the formula to work out the geometery.
    Cheers
    Andy
    www.andypope.info

  4. #4
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464
    Hi,
    As Andy said, it can't be done for those proportions. No one side of a triangle can be longer than the sum of the other two sides for a triangle to exist.

    Do you want to consider some other algorithm which will give you lengths that you could draw as a triangle? If you can I suspect the easier answer will lie in some VBA code which could create three lines of the requisite length, and with simple geometry work out co-ordinate positions for them and hence 'draw' a triangle - however first we need suitable lengths.

    Rgds

  5. #5
    Valued Forum Contributor
    Join Date
    10-15-2007
    Location
    Home
    MS-Off Ver
    Office 2010, W10
    Posts
    373
    Also a possible solution is to use a scatter chart.

    Assuming the lengths of the 3 sides are in B2, B3 and B4, you can use for the vertices of the triangle:

    Point x: 0, 0
    Point y: =B2, 0
    Point z: =(B4^2+B2^2-B3^2)/(2*B2), =(B4^2-((B4^2+B2^2-B3^2)/(2*B2))^2)^(1/2)

    You can draw a scatter chart with these 3 points.

    You'll have then to do some work: clear the chart (no gridlines, axes, etc.), paint the sides of the triangle, format the labels so that each one refers to one side, and deal with the proportion of the axes.

    Although this involves some work to set up, the good news is that you can then change the sides' sizes and you'll get a new valid triangle automatically.

  6. #6
    Registered User
    Join Date
    05-27-2008
    Posts
    25
    Thanks all for your tips, I'll get my VBA for Dummies out and have a go!

+ 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