Page 1 of 1

ColorEachPoint not working

Posted: Thu Sep 15, 2005 3:46 am
by 9638303
Dear Sir

Please test run below the code. The ColorEachPoint not work.....

TChart1.AddSeries (scBar3D)
Call TChart1.Series(0).Add(1232323, "Testing", &H51FF66)
Call TChart1.Series(0).Add(1232323, "Testing2", &H51FF66)
Call TChart1.ChangeSeriesType(0, scPie)
TChart1.Series(0).asPie.AutoMarkPosition = True
TChart1.Series(0).ColorEachPoint = True
TChart1.Repaint

Thank & Best Regard
Eric

Posted: Thu Sep 15, 2005 8:19 am
by narcis
Hi Eric,

This is because you already added points to the series specifying the same colour for all of them (&H51FF66). The code below works fine.

Code: Select all

    TChart1.AddSeries (scBar3D)
    
    Call TChart1.Series(0).Add(1232323, "Testing", clTeeColor)
    Call TChart1.Series(0).Add(1232323, "Testing2", clTeeColor)
    Call TChart1.ChangeSeriesType(0, scPie)
    TChart1.Series(0).asPie.AutoMarkPosition = True
    TChart1.Series(0).ColorEachPoint = True

Posted: Thu Sep 15, 2005 8:57 am
by 9638303
Dear Sir/Madam

The Active-X version 5 works fine on this method and only pie chart we need to user ColorEachPoint. If user change the chart style to bar, we need to remain the custom color set by user.

The code that you given, User not able to retrieve back the color that set by she/he.

So do you got any code can work around?

Thank & Best Regard
Eric

Posted: Thu Sep 15, 2005 9:40 am
by narcis
Hi Eric,

Yes, this is possible, use something similar to:

Code: Select all

Dim Col As OLE_COLOR

Private Sub Command1_Click()
    Call TChart1.ChangeSeriesType(0, scBar)
    TChart1.Series(0).ColorEachPoint = False
    TChart1.Series(0).Color = Col
End Sub

Private Sub Form_Load()
    TChart1.AddSeries (scBar3D)
    
    Col = &H51FF66
    
    Call TChart1.Series(0).Add(1232323, "Testing", Col)
    Call TChart1.Series(0).Add(1232323, "Testing2", Col)
    
    Call TChart1.ChangeSeriesType(0, scPie)
    
    For i = 0 To TChart1.Series(0).Count - 1
        TChart1.Series(0).PointColor(i) = clTeeColor
    Next
    
    TChart1.Series(0).asPie.AutoMarkPosition = True
    TChart1.Series(0).ColorEachPoint = True
End Sub

Posted: Thu Sep 15, 2005 9:54 am
by 9638303
Dear Sir/Madam

Yes.. It work... But no need to define Col


Private Sub Command1_Click()
Call TChart1.ChangeSeriesType(0, scBar)
TChart1.Series(0).ColorEachPoint = False
' TChart1.Series(0).Color = Col
End Sub

Private Sub Form_Load()
TChart1.AddSeries (scBar3D)
TChart1.Series(TChart1.SeriesCount - 1).Color = &H51FF66
'Col = &H51FF66
Call TChart1.Series(TChart1.SeriesCount - 1).Add(1232323, "Testing", TChart1.Series(TChart1.SeriesCount - 1).Color)
Call TChart1.Series(TChart1.SeriesCount - 1).Add(1232323, "Testing2", TChart1.Series(TChart1.SeriesCount - 1).Color)

Call TChart1.ChangeSeriesType(TChart1.SeriesCount - 1, scPie)

For i = 0 To TChart1.Series(0).Count - 1
TChart1.Series(TChart1.SeriesCount - 1).PointColor(i) = clTeeColor
Next

TChart1.Series(TChart1.SeriesCount - 1).asPie.AutoMarkPosition = True
TChart1.Series(TChart1.SeriesCount - 1).ColorEachPoint = True
End Sub

Anyway.. Thank a lot....

Eric