Legend Color

TeeChart for ActiveX, COM and ASP
Post Reply
Newbie
Newbie
Posts: 2
Joined: Tue Nov 18, 2003 5:00 am

Legend Color

Post by » Mon Dec 01, 2003 8:04 pm

Hi!

I've had some troubles with the chart that have more than one series.
I'm trying to make one self stacked chart, and the color reference in the legend doesn't appear.

Please, review the following source code and tell me what is the problem.
(Put one TChart and a Command Button in a form)

Tks
Christian Sabino

Code: Select all

Private Sub Command1_Click()
Dim iSer As Integer
iSer = TChart1.AddSeries(scBar)
TChart1.Series(iSer).Add 10, "Serie 1", clTeeColor
TChart1.Series(iSer).Add 20, "Serie 1", clTeeColor
TChart1.Series(iSer).Add 30, "Serie 1", clTeeColor
TChart1.Series(iSer).Marks.Visible = False
TChart1.Series(iSer).ColorEachPoint = True
TChart1.Series(iSer).asBar.MultiBar = mbSelfStack

iSer = TChart1.AddSeries(scBar)
TChart1.Series(iSer).Add 15, "Serie 2", clTeeColor
TChart1.Series(iSer).Add 25, "Serie 2", clTeeColor
TChart1.Series(iSer).Add 35, "Serie 2", clTeeColor
TChart1.Series(iSer).Marks.Visible = False
TChart1.Series(iSer).ColorEachPoint = True
TChart1.Series(iSer).asBar.MultiBar = mbSelfStack


End Sub



Pep
Site Admin
Site Admin
Posts: 3295
Joined: Fri Nov 14, 2003 5:00 am
Contact:

Post by Pep » Mon Dec 01, 2003 11:47 pm

Hi Christian,

this is by default, you cannot assign the Color for the legend symbol of one Series with multiple colors (I think this feature will be available for the next TeeChart Pro v7).

Also, if you want to show the Series color in the legend you can do something like this :
TChart1.Series(iSer).ColorEachPoint = False
TChart1.Series(iSer).Color = vbBlue

Josep Lluis Jorge
http://support.steema.com

Newbie
Newbie
Posts: 2
Joined: Tue Nov 18, 2003 5:00 am

Make a simple stacked bar chart

Post by » Tue Dec 02, 2003 12:44 pm

Tks for your response.

Now, I'm trying to make the following chart, I made first with Excel 2000. I have a table with the data and make a simple chart stacked column.

Muy.Dificil Dificil Media Facil Muy.Facil
02/11 33 3 3 1
9/11 28 4 3 1
16/11 27 2 2 1 1
23/11 19
30/11 26 1 1
1/12 30 1 1

Selecting this data and making a simple chart give the char that I want, but if I load this information in Tee make other chart. Maybe Tee is taking the series in other way.

This is the code

Code: Select all

Private Sub Command1_Click()
Dim iSer As Integer
iSer = TChart1.AddSeries(scBar)
TChart1.Series(iSer).Add 33, "02/11", clTeeColor
TChart1.Series(iSer).Add 28, "09/11", clTeeColor
TChart1.Series(iSer).Add 27, "16/11", clTeeColor
TChart1.Series(iSer).Add 19, "23/11", clTeeColor
TChart1.Series(iSer).Add 26, "30/11", clTeeColor
TChart1.Series(iSer).Add 30, "1/12", clTeeColor
TChart1.Series(iSer).Marks.Visible = False
TChart1.Series(iSer).ColorEachPoint = False
TChart1.Series(iSer).Color = vbRed
TChart1.Series(iSer).asBar.MultiBar = mbSelfStack
TChart1.Series(iSer).Title = "Muy Dificil"

iSer = TChart1.AddSeries(scBar)
TChart1.Series(iSer).Add 3, "02/11", clTeeColor
TChart1.Series(iSer).Add 4, "09/11", clTeeColor
TChart1.Series(iSer).Add 2, "16/11", clTeeColor
TChart1.Series(iSer).Add 0, "23/11", clTeeColor
TChart1.Series(iSer).Add 0, "30/11", clTeeColor
TChart1.Series(iSer).Add 0, "1/12", clTeeColor
TChart1.Series(iSer).Marks.Visible = False
TChart1.Series(iSer).ColorEachPoint = False
TChart1.Series(iSer).Color = vbYellow
TChart1.Series(iSer).asBar.MultiBar = mbSelfStack
TChart1.Series(iSer).Title = "Dificil"

iSer = TChart1.AddSeries(scBar)
TChart1.Series(iSer).Add 3, "02/11", clTeeColor
TChart1.Series(iSer).Add 3, "09/11", clTeeColor
TChart1.Series(iSer).Add 2, "16/11", clTeeColor
TChart1.Series(iSer).Add 0, "23/11", clTeeColor
TChart1.Series(iSer).Add 0, "30/11", clTeeColor
TChart1.Series(iSer).Add 0, "1/12", clTeeColor
TChart1.Series(iSer).Marks.Visible = False
TChart1.Series(iSer).ColorEachPoint = False
TChart1.Series(iSer).Color = vbGreen
TChart1.Series(iSer).asBar.MultiBar = mbSelfStack
TChart1.Series(iSer).Title = "Media"

iSer = TChart1.AddSeries(scBar)
TChart1.Series(iSer).Add 1, "02/11", clTeeColor
TChart1.Series(iSer).Add 1, "09/11", clTeeColor
TChart1.Series(iSer).Add 1, "16/11", clTeeColor
TChart1.Series(iSer).Add 0, "23/11", clTeeColor
TChart1.Series(iSer).Add 1, "30/11", clTeeColor
TChart1.Series(iSer).Add 1, "1/12", clTeeColor
TChart1.Series(iSer).Marks.Visible = False
TChart1.Series(iSer).ColorEachPoint = False
TChart1.Series(iSer).Color = vbWhite
TChart1.Series(iSer).asBar.MultiBar = mbSelfStack
TChart1.Series(iSer).Title = "Facil"

iSer = TChart1.AddSeries(scBar)
TChart1.Series(iSer).Add 0, "02/11", clTeeColor
TChart1.Series(iSer).Add 0, "09/11", clTeeColor
TChart1.Series(iSer).Add 1, "16/11", clTeeColor
TChart1.Series(iSer).Add 0, "23/11", clTeeColor
TChart1.Series(iSer).Add 1, "30/11", clTeeColor
TChart1.Series(iSer).Add 1, "1/12", clTeeColor
TChart1.Series(iSer).Marks.Visible = False
TChart1.Series(iSer).ColorEachPoint = False
TChart1.Series(iSer).Color = vbBlue
TChart1.Series(iSer).asBar.MultiBar = mbSelfStack
TChart1.Series(iSer).Title = "Muy Facil"

End Sub

Please, I need to make this kind of chart for my app.

Tks again

Christian Sabino

Pep
Site Admin
Site Admin
Posts: 3295
Joined: Fri Nov 14, 2003 5:00 am
Contact:

Post by Pep » Tue Dec 02, 2003 7:58 pm

I think you should use the following code to see what you get what you want :

Code: Select all

Private Sub Command1_Click()
Dim iSer As Integer
iSer = TChart1.AddSeries(scBar)
TChart1.Series(iSer).Add 33, "02/11", clTeeColor
TChart1.Series(iSer).Add 28, "09/11", clTeeColor
TChart1.Series(iSer).Add 27, "16/11", clTeeColor
TChart1.Series(iSer).Add 19, "23/11", clTeeColor
TChart1.Series(iSer).Add 26, "30/11", clTeeColor
TChart1.Series(iSer).Add 30, "1/12", clTeeColor
TChart1.Series(iSer).Marks.Visible = False
TChart1.Series(iSer).ColorEachPoint = False
TChart1.Series(iSer).Color = vbRed
TChart1.Series(iSer).Title = "Muy Dificil"

iSer = TChart1.AddSeries(scBar)
TChart1.Series(iSer).Add 3, "02/11", clTeeColor
TChart1.Series(iSer).Add 4, "09/11", clTeeColor
TChart1.Series(iSer).Add 2, "16/11", clTeeColor
TChart1.Series(iSer).Add 0, "23/11", clTeeColor
TChart1.Series(iSer).Add 0, "30/11", clTeeColor
TChart1.Series(iSer).Add 0, "1/12", clTeeColor
TChart1.Series(iSer).Marks.Visible = False
TChart1.Series(iSer).ColorEachPoint = False
TChart1.Series(iSer).Color = vbYellow
TChart1.Series(iSer).Title = "Dificil"

iSer = TChart1.AddSeries(scBar)
TChart1.Series(iSer).Add 3, "02/11", clTeeColor
TChart1.Series(iSer).Add 3, "09/11", clTeeColor
TChart1.Series(iSer).Add 2, "16/11", clTeeColor
TChart1.Series(iSer).Add 0, "23/11", clTeeColor
TChart1.Series(iSer).Add 0, "30/11", clTeeColor
TChart1.Series(iSer).Add 0, "1/12", clTeeColor
TChart1.Series(iSer).Marks.Visible = False
TChart1.Series(iSer).ColorEachPoint = False
TChart1.Series(iSer).Color = vbGreen
TChart1.Series(iSer).Title = "Media"

iSer = TChart1.AddSeries(scBar)
TChart1.Series(iSer).Add 1, "02/11", clTeeColor
TChart1.Series(iSer).Add 1, "09/11", clTeeColor
TChart1.Series(iSer).Add 1, "16/11", clTeeColor
TChart1.Series(iSer).Add 0, "23/11", clTeeColor
TChart1.Series(iSer).Add 1, "30/11", clTeeColor
TChart1.Series(iSer).Add 1, "1/12", clTeeColor
TChart1.Series(iSer).Marks.Visible = False
TChart1.Series(iSer).ColorEachPoint = False
TChart1.Series(iSer).Color = vbWhite
TChart1.Series(iSer).Title = "Facil"

iSer = TChart1.AddSeries(scBar)
TChart1.Series(iSer).Add 0, "02/11", clTeeColor
TChart1.Series(iSer).Add 0, "09/11", clTeeColor
TChart1.Series(iSer).Add 1, "16/11", clTeeColor
TChart1.Series(iSer).Add 0, "23/11", clTeeColor
TChart1.Series(iSer).Add 1, "30/11", clTeeColor
TChart1.Series(iSer).Add 1, "1/12", clTeeColor
TChart1.Series(iSer).Marks.Visible = False
TChart1.Series(iSer).ColorEachPoint = False
TChart1.Series(iSer).Color = vbBlue
TChart1.Series(iSer).Title = "Muy Facil"
TChart1.Series(iSer).asBar.MultiBar = mbStacked
End Sub
Just changing the following line :
TChart1.Series(iSer).asBar.MultiBar = mbSelfStack
by :
TChart1.Series(iSer).asBar.MultiBar = mbStacked

Josep Lluis Jorge
http://support.steema.com

Post Reply