Solved

Draw 4 arcs around circle in Excel

Posted on 2013-12-07
6
712 Views
Last Modified: 2013-12-07
Hi Im trying to do something Im not sure is possible.  I have 8 cells which have a value of between 0 & 360 degrees.  the values in cells 1 & 2 are paired, 3 & 4 are paired, 5 & 6, etc..

The idea I am trying to look into is to take the values in the cells of a pair and plot them on a circle with a coloured line between them.  I would then take the next pair and add them to the circle and so on.

Is this possible?  If its best in VBA Im not adverse to that!

Many thanks

Simon
0
Comment
Question by:simonwait
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
6 Comments
 
LVL 81

Expert Comment

by:byundt
ID: 39703286
Simon,
Would a pie chart do what you need?

I assumed that each pair of values comprised the starting and ending angle for the arc segment. I also assumed that the arc segments were non-overlapping.

Using those assumptions, I put the angles in cells A2:A9, with 360 in cell A10. I then put the following formula in cell F2 and copied it down.
=A2-SUM(F1)

I plotted the values from column F in a pie chart. Every other segment I colored white. These represent the "gaps" between the arcs.

I then made the plot area have a transparent fill (so you can see the gridlines behind it), with no border. I deleted the white blocks from the legend (left-click it twice to select just that point in the legend, then delete).
Arcmaster-Q28312965.xlsm
0
 
LVL 1

Author Comment

by:simonwait
ID: 39703301
It could work if there was a way to only colour the outer edge of the pie.  Im trying to graphically represent objects which rotate around this circle so I think a pie image is a little confusing but certainly moving in the right direction!
0
 
LVL 81

Expert Comment

by:byundt
ID: 39703327
I changed the chart to a donut chart, then made the "hole" be 90% of the OD. This gives a nice thick arc segment.
Arcmaster-Q28312965.xlsm
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 81

Accepted Solution

by:
byundt earned 500 total points
ID: 39703339
Perhaps better yet, I changed the white fill for the "gaps" to a medium gray, then made the borders use an Automatic color. I also made the border width 0, which decreased the size of the white gaps between arc segments. The gray color completes the circle, and the automatic line color makes them disappear.
Arcmaster-Q28312965.xlsm
0
 
LVL 43

Expert Comment

by:Saqib Husain, Syed
ID: 39703412
How about a scatter chart?
Arcs-by-scatter.xlsx
0
 
LVL 81

Expert Comment

by:byundt
ID: 39703681
Here is a macro that will draw four arcs of a specified radius at a specified location. Each arc will have a different color.

As written, the starting and ending angular positions of each arc segment are listed in ordered pairs in cells A2:A9. The arc segments are initially placed at cell N20, though they are subsequently rotated and stretched.
Sub ArcMaker()
Dim shp As Shape
Dim i As Long
Dim OD As Single
Dim rg As Range, targ As Range
Set rg = Worksheets(1).Range("A2:A9")   'Angle beginnings and ends as ordered pairs
Set targ = Worksheets(1).Range("N20")   'Draw circle here
OD = 36 'Diameter of circle (pixels)
For i = 1 To rg.Cells.Count Step 2
    Set shp = ActiveSheet.Shapes.AddShape(msoShapeArc, targ.Left, targ.Top, 36, 36)
    With shp
        .Adjustments.Item(2) = rg.Cells(i + 1, 1).Value - rg.Cells(i, 1).Value - 90
        .Line.ForeColor.ObjectThemeColor = i
        .Line.Weight = 5
        .Rotation = rg.Cells(i, 1).Value
    End With
Next
End Sub

Open in new window

0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Access developers frequently have requirements to interact with Excel (import from or output to) in their applications.  You might be able to accomplish this with the TransferSpreadsheet and OutputTo methods, but in this series of articles I will di…
In Part II of this series, I will discuss how to identify all open instances of Excel and enumerate the workbooks, spreadsheets, and named ranges within each of those instances.
The viewer will learn how to create a normally distributed random variable in Excel, use a normal distribution to simulate the return on an investment over a period of years, Create a Monte Carlo simulation using a normal random variable, and calcul…
This Micro Tutorial demonstrates in Microsoft Excel how to consolidate your marketing data by creating an interactive charts using form controls. This creates cool drop-downs for viewers of your chart to choose from.

739 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question