View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.charting
Peter T Peter T is offline
external usenet poster
 
Posts: 5,600
Default Vary Colors By Point

You say your chart contains two series, but VaryByCategories can only be
applied to the ONE AND ONLY series on the chart. You could apply your own
colour to each point. Here's a VBA example

Sub VBPseries1()
Dim i As Long
Dim cht As Chart
Dim sr As Series
Dim pt As Point
Set cht = ActiveChart ' the selected chart
Set sr = cht.SeriesCollection(1)
i = 24
For Each pt In sr.Points
i = i + 1
If i Mod 57 = 0 Then i = 1
With pt
'.Border.ColorIndex = i ' only if Line
.MarkerForegroundColorIndex = i
.MarkerBackgroundColorIndex = i
End With
Next

End Sub

Regards,
Peter T



"SrikanthAdimulam" wrote in
message ...
I am accessing excel through .NET C#..

I have two data series in a chart(XYScatterLines)..And I want to vary

color
by point
of one series ...Infact I am not able to do that directly in excel

manually...

Please help me out....

I even Tried following code..

grp = (ChartGroup)newChartObject.Chart.ChartGroups(1);
grp.VaryByCategories = true;