Hi
If there are say 10 series on the chart and there is checkboxes on the chart legend to allow selection of each one how do I get the first selected series (ie. the first series with the checkbox checked).We are using TeeChart version 3.5.3187.15585 and C#.NET
Thanks
How do I read first series selected from legend checkboxes?
Re: How do I read first series selected from legend checkboxes?
Hello Dave,
I have made a simple code that I think help you to achieve as you want:
Could you tell us if previous code works as you want?
Thanks,
I have made a simple code that I think help you to achieve as you want:
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 isFirstVisible;
int index;
void tChart1_ClickLegend(object sender, MouseEventArgs e)
{
index = 0;
isFirstVisible = false;
while(index<tChart1.Series.Count && !isFirstVisible)
{
if (tChart1[index].Active)
{
isFirstVisible = true;
}
else
{
isFirstVisible = false;
index++;
}
}
if (isFirstVisible)
{
this.Text = tChart1[index].Title;
}
}
Thanks,
Best Regards,
Sandra Pazos / Development & Support Steema Software Avinguda Montilivi 33, 17003 Girona, Catalonia Tel: 34 972 218 797 http://www.steema.com |
Instructions - How to post in this forum |