Graphs


Posted by Sharon on September 02, 1999 8:36 AM

I make graphs with columns representing monthly data. In that same graph I want to show a line or shaded background representing the mean. Is there a way to do that and how?

Sharon

Posted by Chris on September 02, 1999 11:19 AM

Sharon,

There is a way to get a line representing the mean. What you will have to do is add another column to the source data using Excel's Average() function. Copy this down so that the same value is repeating for the entire data range. Once those bars have appeared on the graph, right click one of the average bars and choose chart type. Click on the "Custom Types" tab and choose "Line - Column"

This should change that series to a line going straight across the graph. To remove the markers on the line, right click the line, choose "Format Data Series," and under Markers, choose none.

Hope that helps.

Chris

Posted by Ivan Moala on September 02, 1999 3:59 PM

Chris is correct, but if as above you don't have
the Avg line appear then select the avg range of data,
select the border (For a drag & drop) and move this
to your graph.
everything else is as chris said.


Ivan

Posted by CHUCK HANCHER on September 05, 1999 12:42 PM

try this chuck
this is the sub to change your
line colors for each segment of the plot
line. the problem is that the "Chart no and
segment/point no. can not be programmed,
they must be changed manually
'
Sub color_3()

ActiveSheet.ChartObjects("Chart 1").Activate
ActiveChart.SeriesCollection(1).Points(2).Select
With Selection.Border
' line color
.ColorIndex = 4
.Weight = xlMedium
.LineStyle = xlContinuous
End With
With Selection
.MarkerBackgroundColorIndex = 25
.MarkerForegroundColorIndex = 25
.MarkerStyle = xlSquare

End With
End Sub

I tried to get this program to work
but failed, you may be able to see if
it will be of any value

color_2 Macro
' Macro recorded 9/2/99 by c.w. hancher
' chancher@icx.net
'
Sub color_2()

' ^^^^^^^^^ input section ^^^^^^^
' P= NUMBER OF PIONTS
P = 3

'V* =VALUE LEVELS FOR COLORS
V1 = 50
V2 = 75
V3 = 105
V4 = 130
V5 = 150
' PICK COLORS FOR EACH VALUE LEVEL AND NUMNER
' line color
' blue = 5
' orange = 22
' red = 3
' green = 4
' black = 5
C1 = 5
C2 = 22
C3 = 3
C4 = 5
C5 = 4

'SELECT COLOR FOR THE POINTS SECTION
' DATA AREA
' R=ROW DATA STARTS
R = 3
'COLUMN DATA STARTS NUMBER
C = 3


'LOOP SECTION *************
For H = 1 To P
MsgBox H, , "H"
MsgBox R, , "R"
MsgBox C, , "C"
X=CELLS(R,C)
If X <= V1 Then GoTo 1
If X <= V2 Then GoTo 2
If X <= V3 Then GoTo 3
If X <= V4 Then GoTo 4
If X <= V5 Then GoTo 5


'ADD COLOR TO POINTS SECTION ########
'POINT-1 AREA
1 A = 1
MsgBox A, , "A"
ActiveSheet.ChartObjects("Chart 8 ").Activate
ActiveChart.SeriesCollection(1).Points(1).Select
With Selection.Border

.ColorIndex = C1
.Weight = xlMedium
.LineStyle = xlContinuous
End With
With Selection

.MarkerBackgroundColorIndex = 25

.MarkerBackgroundColorIndex = 25

.MarkerStyle = xlSquare
End With
MsgBox C1, , "C1"
R = R + 1
X = 0
GoTo 6

'POINT-2 AREA &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
2 A = 2
MsgBox A, , "A"
ActiveSheet.ChartObjects("Chart 8").Activate
ActiveChart.SeriesCollection(1).Points(2).Select
With Selection.Border

.ColorIndex = C2
.Weight = xlMedium
.LineStyle = xlContinuous
End With
With Selection

.MarkerBackgroundColorIndex = 25

.MarkerBackgroundColorIndex = 25

.MarkerStyle = xlSquare
End With
R = R + 1
GoTo 6


'POINT-3 AREA&&&&&&&&&&&&&&&&&&&
3 ActiveSheet.ChartObjects("Chart 8").Activate
ActiveChart.SeriesCollection(1).Points(3).Select


With Selection.Border

.ColorIndex = C3
.Weight = xlMedium
.LineStyle = xlContinuous
End With
With Selection

.MarkerBackgroundColorIndex = 25

.MarkerBackgroundColorIndex = 25

.MarkerStyle = xlSquare
End With
R = R + 1
GoTo 6

'POINT-4 AREA&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
4 ActiveSheet.ChartObjects("Chart 1").Activate
ActiveChart.SeriesCollection(1).Points(4).Select
With Selection.Border

.ColorIndex = C4
.Weight = xlMedium
.LineStyle = xlContinuous
End With
With Selection

.MarkerBackgroundColorIndex = 25

.MarkerBackgroundColorIndex = 25

.MarkerStyle = xlSquare
End With
R = R + 1
GoTo 6

'POINT-5 AREA&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
5 ActiveSheet.ChartObjects("Chart 1").Activate
ActiveChart.SeriesCollection(1).Points(5).Select
With Selection.Border

.ColorIndex = C5
.Weight = xlMedium
.LineStyle = xlContinuous
End With
With Selection

.MarkerBackgroundColorIndex = 25

.MarkerBackgroundColorIndex = 25

.MarkerStyle = xlSquare
End With
R = R + 1
6 Next H

End Sub



Posted by Sharon on September 10, 1999 2:21 PM

Thanks so much for all of your help. I took your advise and it worked like a dream. You saved me a huge headache.

Thanks again,
Sharon