Page 1 of 1

fuction to read out the legends checked checkboxes

Posted: Thu Nov 15, 2012 2:25 pm
by 15660870
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}

Re: fuction to read out the legends checked checkboxes

Posted: Fri Nov 16, 2012 10:17 am
by 10050769
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,

Re: fuction to read out the legends checked checkboxes

Posted: Fri Nov 16, 2012 1:00 pm
by 15660870
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