Page 1 of 1

Series.Clear() Problem

Posted: Tue Aug 29, 2006 9:14 am
by 8127541
I need to plot a Point series during runtime that depends on what the user selects. The idea is that only one series is displayed at a time. Therefor, e.g. user selects series A, which is plotted, then the user selects Series B which is then plotted, while series A is removed. I've used Clear(), but it doesn't remove Series A at all.

Regards,
Casper JH Erasmus

Posted: Tue Aug 29, 2006 9:29 am
by narcis
Hi Casper JH Erasmus,

Clear method deletes series values, colors, labels, etc. To delete the series you'd better use Remove method as shown here:

Code: Select all

    private void Form1_Load(object sender, EventArgs e)
    {
      Steema.TeeChart.Styles.Line line1 = new Steema.TeeChart.Styles.Line(tChart1.Chart);
      line1.FillSampleValues();

      tChart1.Header.Text = tChart1.Series.Count.ToString();
    }

    private void button1_Click(object sender, EventArgs e)
    {
      tChart1.Series.Remove(tChart1[0]);

      Steema.TeeChart.Styles.Bar bar1 = new Steema.TeeChart.Styles.Bar(tChart1.Chart);
      bar1.FillSampleValues();

      tChart1.Header.Text = tChart1.Series.Count.ToString();
    }