TeeChart for ActiveX, COM and ASP
-
KTB
- Newbie
- Posts: 20
- Joined: Fri Oct 22, 2004 4:00 am
Post
by KTB » Tue May 10, 2005 6:32 pm
I know I've had this issue before & I can't remember how to fix it. I want every slice of the pie to be a different color Using VFP 9.0 with TeeChart Pro v7.0.0.2, with a Pie Chart. Color Each Slice is checked. What am I supposed to pass to .Series[0].Add(nVal,cVal,?nColor) as nColor? Here's the code to setup the data...
Code: Select all
.Series[0].Title = cSeriesName
FOR i = 1 TO .SeriesCount
.Series[i-1].Clear
ENDFOR
.Axis.Left.Labels.RoundFirstLabel = .T. && Always round off axis labels.
.Axis.Bottom.Labels.RoundFirstLabel = .T. && Always round off axis labels.
SELECT (cDataSource)
num_Fields = FCOUNT(cDataSource)
cLblField = FIELD(1)
SCAN ALL
FOR i = 1 TO MIN(num_fields - ,.SeriesCount) && Now insert the data
cValField = FIELD(i+1)
.Series[i-1].ColorEachPoint = .T.
.Series[i-1].Add(NVL(&cValField,0),ALLTRIM(TRANSFORM(&cLblField)),.Series[i-1].Color)
ENDFOR
ENDSCAN
.Visible = .T.
TIA
Ken
-
Pep
- Site Admin
- Posts: 3303
- Joined: Fri Nov 14, 2003 5:00 am
-
Contact:
Post
by Pep » Thu May 12, 2005 6:10 am
Hi Ken,
passing a correct RGB color should be sufficient, as in the following code :
Code: Select all
Form1.OleControl1.Series(0).Add( 100, 'Apples', RGB( 255, 0,0) )
Form1.OleControl1.Series(0).Add( 300, 'Pears', RGB( 0,255,0) )
Form1.OleControl1.Series(0).Add( 200, 'Bananas', RGB( 255,255,0) )
-
KTB
- Newbie
- Posts: 20
- Joined: Fri Oct 22, 2004 4:00 am
Post
by KTB » Thu May 12, 2005 1:00 pm
I thought there was some way for TeeChart to handle this itself. Guess not, so I used RAND()*RGB(255,255,255) to generate random colors. Thanks.