Questions about ActiveStyle

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
randy.xia
Newbie
Newbie
Posts: 1
Joined: Mon Apr 29, 2024 12:00 am

Questions about ActiveStyle

Post by randy.xia » Sat May 11, 2024 3:57 am

TeeChart for NET Std Business Edition,Legend.checkboxes is out of date, prompting to use ActiveStyle, but the function can not be realized by using ActiveStyle, why is this? How to solve it?

Edu
Newbie
Newbie
Posts: 39
Joined: Tue Nov 28, 2023 12:00 am

Re: Questions about ActiveStyle

Post by Edu » Mon May 13, 2024 7:51 am

Hello, thanks for asking.

You can still use the deprecated approach 'tChart1.Legend.CheckBoxes = true", but it is very recommended to use the ActiveStyle property instead.
This is how to use the ActiveStyle property:

Code: Select all

 tChart1.Legend.ActiveStyle = LegendActiveStyles.CheckBox;
Here's a quick example:

Code: Select all

private void ChartSetup()
        {
            //Example with two lines, different color
            Line myLine = new();
            myLine.Color = Color.Red;
            Line mySecondLine = new();
            mySecondLine.Color = Color.Blue;

            //Fill data
            for (int i = 0; i<10; i++)
            {
                myLine.Add(i, 2 * i);
                mySecondLine.Add(2 * i, i);
            }

            //Adding lines to Chart
            tChart1.Series.Add(myLine);
            tChart1.Series.Add(mySecondLine);

            // Set the legend's active style to checkbox, as desired.
            tChart1.Legend.ActiveStyle = LegendActiveStyles.CheckBox;
        }
        
This code will create a chart like this one:
Example.png
Example.png (16.45 KiB) Viewed 10874 times
Please be sure to be using the latest release build.
If there's anything else, let us know.

Regards,
Edu
Edu
Steema Support

Post Reply