Page 1 of 1

Teechart editor checkbox event.

Posted: Fri Apr 10, 2015 10:00 am
by 9526439
Hi Steema Support,

We have one query how to get the checkchanged event of Teechart editor checkbox.
Please find attached image.
CheckboxEvent.png
CheckboxEvent
CheckboxEvent.png (59.14 KiB) Viewed 4688 times
please provide any solution asap.
Thanks in advance.

Thanks
PlanoResearch

Re: Teechart editor checkbox event.

Posted: Mon Apr 13, 2015 9:31 am
by Christopher
Hello!

One way of approaching this issue would be the following:

Code: Select all

    private void InitializeChart()
    {
      tChart1.Series.Add(typeof(Line)).FillSampleValues();
      tChart1.Series.Add(typeof(Line)).FillSampleValues();

      tChart1.Chart.Listeners.Add(new ChangeEvent(tChart1.Chart));
    }


    public class ChangeEvent : ITeeEventListener
    {

      private Chart chart;
      public ChangeEvent(Chart c)
      {
        chart = c;
      }

      public void TeeEvent(TeeEvent e)
      {
        if(e is SeriesEvent)
        {
          SeriesEvent tmp = (SeriesEvent)e;
          if(tmp.Event == SeriesEventStyle.ChangeActive)
          {
            string text = "";
            foreach (Series s in chart.Series)
            {
              if(s.Active)
              {
                text += "series " + s.Title + " is active" + Utils.NewLine;
              }

              if(Utils.IsNullOrEmpty(text))
              {
                chart.Header.Text = "no active series";
              }
              else
              {
                chart.Header.Text = text;
              }
            }
          }
        }
      }
    }