Hi.
Is there a way to create an isosceles triangle ( a "pie section") radiating outwards from the centre of a circle and using the centre of the circle as the apex of the triangle? The angle at the apex of the triangle will vary according to the number of triangles needed - just as pie sections do.
I am not keen on using the excel library and manipulating "pie-type" images.
My code, at present, (albeit rather clumsy) describes the circle and the centre point along with a variable number of "spokes" which are numbered at the circumference of the main circle.
After creating the code to insert the "spokes" I figure I would rather triangles (like pie sections) so I can colour fill the interior of each triangle.
Any help will be greatly appreciated.
>>> use code - tags <<<
Regards,
Daics
Is there a way to create an isosceles triangle ( a "pie section") radiating outwards from the centre of a circle and using the centre of the circle as the apex of the triangle? The angle at the apex of the triangle will vary according to the number of triangles needed - just as pie sections do.
I am not keen on using the excel library and manipulating "pie-type" images.
My code, at present, (albeit rather clumsy) describes the circle and the centre point along with a variable number of "spokes" which are numbered at the circumference of the main circle.
After creating the code to insert the "spokes" I figure I would rather triangles (like pie sections) so I can colour fill the interior of each triangle.
Any help will be greatly appreciated.
>>> use code - tags <<<
Code:
Xpt = 10 * 18.75 ' left hand pt on ws
Ypt = 10 * 9.75 ' tp point on ws
w = 10 * 18.75
ht = 10 * 18.75
Set ccl = Sheets("Home").Shapes.AddShape(msoShapeOval, Xpt, Ypt, w, ht)
With ccl
.Fill.ForeColor.RGB = dta_3_clr
.Line.Weight = 2
End With
'CALCULATE CENTRE POINT OF CIRCLE
cptx = Xpt + w / 2 - 5
cpty = Ypt + ht / 2 - 5
'CREATE CENTRE POINT CIRCLE
Set ring = Sheets("Home").Shapes.AddShape(msoShapeOval, cptx, cpty, 10, 10)
With ring
.Name = "ccl_c"
.Fill.ForeColor.RGB = mn_clr
.Line.Visible = msoFalse
End With
'OUTSIDE "TAGS" and "SPOKES"
shp_colr = lge_rng
st = 1
nd = 12
zz = 20
For xxx = st To nd
d = ht / 2
n = xxx / nd * 360 - 90
rd = WorksheetFunction.Radians(n)
x = cptx + d * Cos(rd)
y = cpty + d * Sin(rd)
Set ring = h.Shapes.AddShape(msoShapeOval, x, y, zz, zz)
With ring
.Name = "Ring_" & xxx
.Fill.ForeColor.RGB = mn_clr
.Line.Visible = msoFalse
.TextFrame2.TextRange.Font.Fill.ForeColor.RGB = wht_clr
.TextFrame2.TextRange.Characters.Font.Name = "Lucida Sans"
.TextFrame2.TextRange.Characters.Font.Size = 5
.TextFrame2.VerticalAnchor = msoAnchorMiddle
.TextFrame2.TextRange.ParagraphFormat.Alignment = msoAlignCenter
.TextFrame2.TextRange.Characters.Text = xxx
ln1 = x + zz / 2
ln2 = y + zz / 2
Set Ln_1 = h.Shapes.AddConnector(msoConnectorStraight, cptx + zz / 2, cpty + zz / 2, ln1, ln2)
With Ln_1
.Line.ForeColor.RGB = mn_clr
End With
Set Ln_2 = h.Shapes.AddConnector(msoConnectorStraight, cptx + zz / 2, cpty + zz / 2, ln1, ln2)
With Ln_2
.Line.ForeColor.RGB = mn_clr
End With
End With
Regards,
Daics
Last edited by a moderator: