fuction to read out the legends checked checkboxes

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
asimon
Newbie
Newbie
Posts: 3
Joined: Mon Nov 28, 2011 12:00 am

fuction to read out the legends checked checkboxes

Post by asimon » Thu Nov 15, 2012 2:25 pm

Hi all,

is there any function, where i can read out, if a legend checkbox is checked or to write them into a bool [] e.g.?
ser 1 = checked; ser 2 = unchecked; ser3 = checked --> bool []= {true, false, true}

Sandra
Site Admin
Site Admin
Posts: 3132
Joined: Fri Nov 07, 2008 12:00 am

Re: fuction to read out the legends checked checkboxes

Post by Sandra » Fri Nov 16, 2012 10:17 am

Hello asimon,

I afraid doesn't exist this function . If you want check whant function is visible or not in your chart you can create a condition as check if Series1 is active or not as do in next code where I added the value of series.active in a bool [].

Code: Select all

        public Form1()
        {
            InitializeComponent();
            InitializeChart();
        }
        Steema.TeeChart.Styles.FastLine line1, line2, line3, line4;
        private void InitializeChart()
        {
            tChart1.Aspect.View3D = false;
            line1 = new FastLine(tChart1.Chart);
            line2 = new FastLine(tChart1.Chart);
            line3 = new FastLine(tChart1.Chart);
            line4 = new FastLine(tChart1.Chart);
            line1.FillSampleValues();
            line2.FillSampleValues();
            line3.FillSampleValues();
            line4.FillSampleValues();

            tChart1.Legend.CheckBoxes = true;
            tChart1.ClickLegend  = new MouseEventHandler(tChart1_ClickLegend);
            tChart1.Draw();
        }
        bool[] checkboxes;
        int index; 
        void tChart1_ClickLegend(object sender, MouseEventArgs e)
        {
            checkboxes = new bool[tChart1.Series.Count];
            index = 0; 
            foreach (Steema.TeeChart.Styles.Series s in tChart1.Series)
            {
                checkboxes[index] = s.Active;
                index  ;
              
            }
            tChart1.Header.Text = checkboxes[0].ToString()   ","   checkboxes[1].ToString()   ","   checkboxes[2].ToString()   ","   checkboxes[3].ToString();
        }
Could you tell us if previous code works in your end?

I hope will helps.

Thanks,
Best Regards,
Sandra Pazos / 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

asimon
Newbie
Newbie
Posts: 3
Joined: Mon Nov 28, 2011 12:00 am

Re: fuction to read out the legends checked checkboxes

Post by asimon » Fri Nov 16, 2012 1:00 pm

Hi Sandra,

thanks for this hints. it was very helpfull and i was able to make it work like you suggested.

Thanks al lot
Alexander

Post Reply