Series Color Problem

TeeChart for ActiveX, COM and ASP
Post Reply
Faizullah Khan
Newbie
Newbie
Posts: 50
Joined: Wed Apr 26, 2006 12:00 am

Series Color Problem

Post by Faizullah Khan » Mon May 08, 2006 6:38 am

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

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Mon May 08, 2006 8:40 am

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
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

Faizullah Khan
Newbie
Newbie
Posts: 50
Joined: Wed Apr 26, 2006 12:00 am

Re : Series color Problem

Post by Faizullah Khan » Mon May 08, 2006 11:24 am

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]

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Mon May 08, 2006 1:04 pm

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.
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

Post Reply