--
Bob
*****
Close the loop, so to say, by duplicating the first point as the last
point in a XY Scatter chart. So, to form a rectangle with (1,1),
(2,1), (2,2), and (1,2), add the first point once again. Now, create a
XY Scatter chart with these 5 points. Make sure you use a subtype that
contains a line.
--
Regards,
Tushar Mehta, MS MVP -- Excel
www.tushar-mehta.com
Excel, PowerPoint, and VBA add-ins, tutorials
Custom MS Office productivity solutions
In article <#qzwdOBp...@TK2MSFTNGP10.phx.gbl>,
f...@ke.address.to.avoid.spam says...
There have been macros posted which draw a polygon connecting the points
of an XY series, so you could actually fill in the enclosed shape with
your favorite color. Here's a simple one I put together:
Sub DrawAShape()
Dim myCht As Chart
Dim mySrs As Series
Dim Npts As Integer, Ipts As Integer
Dim myShape As Shape
Dim Xnode As Double, Ynode As Double
Dim Xmin As Double, Xmax As Double
Dim Ymin As Double, Ymax As Double
Dim Xleft As Double, Ytop As Double
Dim Xwidth As Double, Yheight As Double
Set myCht = ActiveChart
Xleft = myCht.PlotArea.InsideLeft
Xwidth = myCht.PlotArea.InsideWidth
Ytop = myCht.PlotArea.InsideTop
Yheight = myCht.PlotArea.InsideHeight
Xmin = myCht.Axes(1).MinimumScale
Xmax = myCht.Axes(1).MaximumScale
Ymin = myCht.Axes(2).MinimumScale
Ymax = myCht.Axes(2).MaximumScale
Set mySrs = myCht.SeriesCollection(1)
Npts = mySrs.Points.Count
Xnode = Xleft + (mySrs.XValues(Npts) - Xmin) _
* Xwidth / (Xmax - Xmin)
Ynode = Ytop + (Ymax - mySrs.Values(Npts)) _
* Yheight / (Ymax - Ymin)
With myCht.Shapes.BuildFreeform(msoEditingAuto, Xnode, Ynode)
For Ipts = 1 To Npts
Xnode = Xleft + (mySrs.XValues(Ipts) - Xmin) _
* Xwidth / (Xmax - Xmin)
Ynode = Ytop + (Ymax - mySrs.Values(Ipts)) _
* Yheight / (Ymax - Ymin)
.AddNodes msoSegmentLine, msoEditingAuto, Xnode, Ynode
Next
Set myShape = .ConvertToShape
End With
With myShape
.Fill.ForeColor.SchemeColor = 13 ' YELLOW
.Line.ForeColor.SchemeColor = 12 ' BLUE
End With
End Sub
- Jon
-------
Jon Peltier, Microsoft Excel MVP
http://www.geocities.com/jonpeltier/Excel/index.html
_______
--
Regards,
Tushar Mehta
MS MVP Excel 2000-2003
www.tushar-mehta.com
Excel, PowerPoint, and VBA tutorials and add-ins
Custom Productivity Solutions leveraging MS Office
In article <et4LFsI...@tk2msftngp13.phx.gbl>,
jonpelti...@yahoo.com says...
But we Bostonians are still Hunting for a Red Sox October.