Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 73
Default Specify style and color of marker in chart

Hello --

User plans to plot no more than 8 data series, and Wants series marker to be
a:

- specified style("shape") (chosen from among 8 preferred shapes), and

- solid color (chosen from among 8 preferred colors)

Shape and color are arbitrarily assigned, depending on the sequence in which
the series is plotted.

Current code successfully plots the data, but does not assign marker style
or color the way we want.

Can someone tell me what is wrong with the following code?


Function SeriesPlot( _
SeriesNum As Integer, _
SeriesName As String, _
RangeSeries As String, _
RangeYVal As String)
Dim srsSeriesNew As Series
...
Set srsSeriesNew = ActiveChart.SeriesCollection.NewSeries
With srsSeriesNew
.Name = SeriesName
.Values = Worksheets("Data_Series").Range(RangeYVal)
.XValues = Worksheets("Data_Series").Range(RangeSeries)

'[a] the above 3 work fine; the following 2 don't give me what I want

.MarkerStyle = GetMarkerStyleInt(SeriesNum) 'result is integer

.MarkerForegroundColorIndex = GetMarkerColorIndx(SeriesNum) 'result is
integer

.MarkerBackgroundColorIndex = 15 'gray
End With
End Function


Function GetMarkerStyleInt(SeriesNum) as Integer
'returns integer related to SeriesNum
'assignment is as follows
...
Case 1
GetMarkerStyleInt = 8 '"xlMarkerStyleCircle"
Case 2
GetMarkerStyleInt = 2 '"xlMarkerStyleDiamond"
Case 3
GetMarkerStyleInt = -4118 '"xlMarkerStyleDot"
Case 4
GetMarkerStyleInt = 9 '"xlMarkerStylePlus"
Case 5
GetMarkerStyleInt = 1 '"xlMarkerStyleSquare"
Case 6
GetMarkerStyleInt = 5 '"xlMarkerStyleStar"
Case 7
GetMarkerStyleInt = 3 '"xlMarkerStyleTriangle"
Case 8
GetMarkerStyleInt = -4168 '"xlMarkerStyleX"
....
End Function


Function GetMarkerColorIndx(SeriesNum) 'returns integer related to
SeriesNum
Dim aryColorIndexes
'color indexes, in order of preference
aryColorIndexes = Array( _
1, _
56, 55, 54, 53, 52, _
49, _
30, _
25, 21, _
18, 13, 11, 10, _
9, 5, _
12, 14, 16, _
23, 29, _
31, 32, _
41, 47, 48, _
50, 51, 3)
GetMarkerColorIndx = aryColorIndexes(SeriesNum - 1)
End Function


Thanks in advance for any help.

Larry Mehl


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
Excel 2007 Chart - determining the color of a chart style Shane Devenshire[_2_] Charts and Charting in Excel 1 February 6th 10 04:09 AM
Changing font style/size/color/etc for multiple series in a chart? Hossdaddy Charts and Charting in Excel 3 January 14th 10 07:36 PM
For "Marker Line Style" see Point.Format.Line.Weight SysMod Charts and Charting in Excel 2 May 13th 09 08:38 AM
add comment to marker in chart [email protected] Charts and Charting in Excel 1 March 25th 07 02:12 AM
marker style change for an individual month JH Charts and Charting in Excel 1 September 19th 06 08:35 PM


All times are GMT +1. The time now is 08:36 PM.

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

About Us

"It's about Microsoft Excel"