#1   Report Post  
Posted to microsoft.public.excel.charting
external usenet poster
 
Posts: 3
Default Line graph colors

Thanks, I think this is the way to go, however its been 10 yrs since I used
any vb in excel. I recalled, that I would have to select the range of cells
that I was operating on, and I didnt see that in the script. I will give it
a try this evening when I get to work. Thanks.

"Andy Pope" wrote:

Hi,

Easiest with VBA code to set the point colour.
This example applys a colour based on positive/negative variation
between points.

'------------------------------------
Sub X()
Dim vntValues As Variant
Dim objPoint As Point
Dim lngItem As Long
Dim lngPoint As Long
With ActiveChart
With .SeriesCollection(1)
vntValues = .Values
lngPoint = 1
For lngItem = LBound(vntValues) + 1 To UBound(vntValues)
lngPoint = lngPoint + 1
If vntValues(lngItem) < vntValues(lngItem - 1) Then
' negative
.Points(lngPoint).Border.ColorIndex = 3 ' red
Else
' same or positive
.Points(lngPoint).Border.ColorIndex = 10 ' green
End If
Next
End With
End With

End Sub
'-----------------------------------

You can adapt this to colour according to cell interior colour by
checking cells rather than series point values.
If the cells are coloured using Conditional formatting then you will
need to do the same test in code to determine whether to apply the
colours or not. The chart will not automatically pick up colour
information from cells.

Cheers
Andy

big_divot wrote:
my spreadsheet contains 3 columns, a date, tournament type, Amount. Each
tournament type is color coded, so it shows a general idea of money won or
lost in the tournaments. I set up a separate worksheet to create a line
graph. and entered a formula =c2 + b1 and copied the range to the bottom, so
it gives me a running total of the tournament winnings and losings. I change
the formulas to a value, using paste special, then I change the color in the
column, using the paste special to format the colors which I have used, so
the column of the running total also contains the colors.
When I graph using the 2d line graph I get a nice graph which looks like a
stock market graph, however its one color. I would like to represent the
colors on the graph, showing the downturns and upturns based on the
tournament type by using the colors in the selected cells. Can anyone offer
a sugestion? thanks.


--

Andy Pope, Microsoft MVP - Excel
http://www.andypope.info

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to convert a dotted line to a solid line in a line graph Sharlz Charts and Charting in Excel 1 January 14th 09 04:51 AM
average Line created in an existing line graph- based on one cell Melanie Charts and Charting in Excel 2 December 27th 07 09:14 PM
How do I graph data daily as a line graph across a calendar format Glani Charts and Charting in Excel 3 November 23rd 07 09:05 AM
How to change color of line and point markers on a line graph SASPerson Charts and Charting in Excel 1 November 15th 06 06:43 PM
Cluster stacked graph AND line combo graph? [email protected] Charts and Charting in Excel 6 October 14th 06 12:33 AM


All times are GMT +1. The time now is 11:50 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"