Page 1 of 1
Questions about ActiveStyle
Posted: Sat May 11, 2024 3:57 am
by 21098030
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?
Re: Questions about ActiveStyle
Posted: Mon May 13, 2024 7:51 am
by edu
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 (16.45 KiB) Viewed 10871 times
Please be sure to be using the latest release build.
If there's anything else, let us know.
Regards,
Edu