Page 1 of 1

Series Color Problem

Posted: Mon May 08, 2006 6:38 am
by 9531181
Hello,
I am using TeeChart V7 for visual basic 6.0.
I'm trying to set specific colours for each Series, but TeeChart assign its own color scheme.
I am assinginig color to series this way

For i = 0 To 15
' add new points to the Series...
TChart2.Series(0).AddXY i + 2, i + 5, " ", vbBlack
TChart2.Series(1).AddXY i + 5, i + 3, "", vbRed
TChart2.Series(2).AddXY i + 12, i + 2, "", vbGreen
TChart2.Series(3).AddXY i + 1, i + 3, "", vbBlue
TChart2.Series(4).AddXY i + 3, i + 6, "", vbMagenta
TChart2.Series(5).AddXY i + 7, i + 9, "", vbCyan
Next

OR

Dim scolor as string
scolor ="&H00000FF,&HFF0000,&H00FF00,&H804040,&H000000,&HFF8000,&HFF8080,&H804A80,&HFF80FF,&H806408"

SeriesColor = Split(scolor, ",") 'SeriesColor is array to hold color

For i = 0 To 15
' add new points to the Series...
TChart2.Series(0).AddXY i + 2, i + 5, "", SeriesColor(0)
TChart2.Series(1).AddXY i + 5, i + 3, "", SeriesColor(1)
TChart2.Series(2).AddXY i + 12, i + 2, "", SeriesColor(2)
TChart2.Series(3).AddXY i + 1, i + 3, "", SeriesColor(3)
TChart2.Series(4).AddXY i + 3, i + 6, "", SeriesColor(4)
TChart2.Series(5).AddXY i + 7, i + 9, "", SeriesColor(5)
TChart2.Series(6).AddXY i + 2, i + 3, "", SeriesColor(6)
TChart2.Series(7).AddXY i + 6, i + 4, "", SeriesColor(7)
TChart2.Series(8).AddXY i + 9, i + 9, "", SeriesColor(8)
TChart2.Series(9).AddXY i + 0, i + 10, "", SeriesColor(9)


Next

is there any proper way to assign the colors to the series.

Regards,

Faizullah

Posted: Mon May 08, 2006 8:40 am
by narcis
Hi Faizullah,

You should use ColorEachPoint property. Try adding something like the code below to your project before populating the series.

Code: Select all

    For j = 0 To TChart2.SeriesCount - 1
        TChart2.Series(j).ColorEachPoint = True
    Next

Re : Series color Problem

Posted: Mon May 08, 2006 11:24 am
by 9531181
Hi,

Thanks
I applied this technique it works fine

For j = 0 To TChart2.SeriesCount - 1
TChart2.Series(j).ColorEachPoint = True
Next

But an other problem is created in legends ,the legend symbols are not displaying ,when we apply the previous technique.

For legend I am using this code

TChart2.Series(j).Title = lLegendTitle
What should we do now

regards

Faizullah Khan


[/code]

Posted: Mon May 08, 2006 1:04 pm
by narcis
Hi Faizullah,

If you have ColorEachPoint to true for each series no legend symbol will be displayed because the legend doesn't know which color should be displaied for each series.