A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Excel » Charts and Charting
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

How do I put multiple colors in a chart's plot area



 
 
Thread Tools Display Modes
  #1  
Old February 17th, 2006, 04:49 PM posted to microsoft.public.excel.charting
external usenet poster
 
Posts: n/a
Default How do I put multiple colors in a chart's plot area

For instance, if I have a single series chart with Y axis from 0% to 5%, how
do I put a red color from 0 to 2%, green from 2 to 4% and blue from 4 to 5%?
  #2  
Old February 19th, 2006, 12:18 PM posted to microsoft.public.excel.charting
external usenet poster
 
Posts: n/a
Default How do I put multiple colors in a chart's plot area

TonyU1234

I am not entirely sure what you need but can offer the following. I am
assuming you have a simple line chart here.

Two options

(1) You can manually select data points and assign them a colour dependent
upon value. Simple to do, but laborious if lots of data points

(2) This VBA code may help. In simple terms, it loops through each data
point, tests the value of the datapoint, and assigns a colour of red 2%:
green 2% - 4%; blue 4%+.

Sub ColorPoints()
Dim i As Long
Dim ChartData As Variant
ChartData = Sheets("Sheet1").ChartObjects(1).Chart.SeriesColle ction(1).Values
For i = 1 To UBound(ChartData)
With Sheets("Sheet1").ChartObjects(1).Chart.SeriesColle ction(1)
Select Case ChartData(i)
Case Is 0.02
.Points(i).Border.ColorIndex = 3
Case Is 0.04
.Points(i).Border.ColorIndex = 10
Case Is 0.04
.Points(i).Border.ColorIndex = 41
End Select
End With
Next i
End Sub

You may have to change some of the references to make this work e.g. the
worksheet / chartobject references etc.

Hope this helps.

Regards


Alex
"TonyU1234" wrote:

For instance, if I have a single series chart with Y axis from 0% to 5%, how
do I put a red color from 0 to 2%, green from 2 to 4% and blue from 4 to 5%?

  #3  
Old February 19th, 2006, 12:50 PM posted to microsoft.public.excel.charting
external usenet poster
 
Posts: n/a
Default How do I put multiple colors in a chart's plot area

Hi,

If you want colour banding on the plot area you can produce this effect
by adding 3 dummy series and plotting them as stacked column.
The values for each point in each series will be 2% , 2% and 1%.
Format the columns to be the correct colours also remove the border.
On the Format dialogs Options tab set the Gapwidth to 0.

Cheers
Andy

TonyU1234 wrote:
For instance, if I have a single series chart with Y axis from 0% to 5%, how
do I put a red color from 0 to 2%, green from 2 to 4% and blue from 4 to 5%?


--

Andy Pope, Microsoft MVP - Excel
http://www.andypope.info
  #4  
Old February 19th, 2006, 07:29 PM posted to microsoft.public.excel.charting
external usenet poster
 
Posts: n/a
Default How do I put multiple colors in a chart's plot area

An easier, non-VBA technique is described he

http://peltiertech.com/Excel/Charts/...nalChart1.html

I think the OP wanted the background colored, though, not the data series.

- Jon
-------
Jon Peltier, Microsoft Excel MVP
Peltier Technical Services
Tutorials and Custom Solutions
http://PeltierTech.com/
_______

"Alex" wrote in message
...
TonyU1234

I am not entirely sure what you need but can offer the following. I am
assuming you have a simple line chart here.

Two options

(1) You can manually select data points and assign them a colour dependent
upon value. Simple to do, but laborious if lots of data points

(2) This VBA code may help. In simple terms, it loops through each data
point, tests the value of the datapoint, and assigns a colour of red 2%:
green 2% - 4%; blue 4%+.

Sub ColorPoints()
Dim i As Long
Dim ChartData As Variant
ChartData =
Sheets("Sheet1").ChartObjects(1).Chart.SeriesColle ction(1).Values
For i = 1 To UBound(ChartData)
With Sheets("Sheet1").ChartObjects(1).Chart.SeriesColle ction(1)
Select Case ChartData(i)
Case Is 0.02
.Points(i).Border.ColorIndex = 3
Case Is 0.04
.Points(i).Border.ColorIndex = 10
Case Is 0.04
.Points(i).Border.ColorIndex = 41
End Select
End With
Next i
End Sub

You may have to change some of the references to make this work e.g. the
worksheet / chartobject references etc.

Hope this helps.

Regards


Alex
"TonyU1234" wrote:

For instance, if I have a single series chart with Y axis from 0% to 5%,
how
do I put a red color from 0 to 2%, green from 2 to 4% and blue from 4 to
5%?



  #5  
Old February 19th, 2006, 07:30 PM posted to microsoft.public.excel.charting
external usenet poster
 
Posts: n/a
Default How do I put multiple colors in a chart's plot area

This web page describes a technique, which could probably be adjusted to
give the OP the desired effect:

http://peltiertech.com/Excel/Charts/...ticalBand.html


- Jon
-------
Jon Peltier, Microsoft Excel MVP
Peltier Technical Services
Tutorials and Custom Solutions
http://PeltierTech.com/
_______

"Andy Pope" wrote in message
...
Hi,

If you want colour banding on the plot area you can produce this effect by
adding 3 dummy series and plotting them as stacked column.
The values for each point in each series will be 2% , 2% and 1%.
Format the columns to be the correct colours also remove the border.
On the Format dialogs Options tab set the Gapwidth to 0.

Cheers
Andy

TonyU1234 wrote:
For instance, if I have a single series chart with Y axis from 0% to 5%,
how do I put a red color from 0 to 2%, green from 2 to 4% and blue from 4
to 5%?


--

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



 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Print Excel charts in Word 2003 with fixed size Phil Charts and Charting 1 November 3rd, 2005 04:24 AM
Multiple charts Jo Ball Charts and Charting 1 April 22nd, 2005 01:39 AM
Setting custom chart causes plot area to collapse Chiara Charts and Charting 0 January 20th, 2005 05:32 PM
Fill area beneath a scatter plot JZip Charts and Charting 4 December 8th, 2004 01:59 PM
Multiple charts in one sheet Shovelman Charts and Charting 1 October 12th, 2003 03:38 AM


All times are GMT +1. The time now is 02:17 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.