Page 1 of 1

Show in TeeListBox

Posted: Mon Apr 23, 2007 3:19 pm
by 9528872
Hi

Simple question, exists a property or method that allows hide or show a serie in the TeeListBox as ShowInLegend property of ISeries ??

Thanks in advance.

Posted: Tue Apr 24, 2007 9:38 am
by yeray
Hi ACC,

There's no method to show/hide series individually from a TeeListBox yet but you can assign a group to the TeeListBox. So you can create your custom group and the TeeListBox will only show the series you wish.

At the following example I use ComboBoxes to select the series to show. But note that in each ComboBox I delete and create again the SeriesGroup:

Code: Select all

Private Sub Check1_Click()
  TChart1.SeriesList.Groups.Delete 0
  TChart1.SeriesList.AddGroup "Group 0"
  
  If Check1.Value Then
    TChart1.SeriesList.Groups.Items(0).Add 0
  End If
  
  If Check2.Value Then
    TChart1.SeriesList.Groups.Items(0).Add 1
  End If
  
  TeeListBox1.SeriesGroup = TChart1.SeriesList.Groups.Items(0)
  TeeListBox1.UpdateSeries
End Sub

Private Sub Check2_Click()
  TChart1.SeriesList.Groups.Delete 0
  TChart1.SeriesList.AddGroup "Group 0"
  
  If Check1.Value Then
    TChart1.SeriesList.Groups.Items(0).Add 0
  End If
  
  If Check2.Value Then
    TChart1.SeriesList.Groups.Items(0).Add 1
  End If
  
  TeeListBox1.SeriesGroup = TChart1.SeriesList.Groups.Items(0)
  TeeListBox1.UpdateSeries
End Sub

Private Sub Form_Load()
  TChart1.AddSeries scBar
  TChart1.AddSeries scBar
  
  TChart1.Series(0).FillSampleValues
  TChart1.Series(1).FillSampleValues

  TChart1.SeriesList.AddGroup "Group 0"
  
  'you should set the ComboBoxes to Checked by default
  TChart1.SeriesList.Groups.Items(0).Add 0
  TChart1.SeriesList.Groups.Items(0).Add 1

  TeeListBox1.Chart = TChart1
  TeeListBox1.SeriesGroup = TChart1.SeriesList.Groups.Items(0)
End Sub

Posted: Tue Apr 24, 2007 11:16 am
by yeray
And I can announce the new property "Items" for TeeListBoxes, available for the next release v8. So you will be able to do:

Code: Select all

TeeListBox1.Items.Remove (0)

Posted: Tue Apr 24, 2007 7:59 pm
by 9528872
Thank you very much.

Saludos