Page 1 of 1

Dynamically Adding Fastline Series?

Posted: Fri Jun 05, 2009 4:47 am
by 15653335
Hello,

I am trying to dynamically add multiple fastline series to a chart. I have done this easily in the past using the active x component via "TChart1.AddSeries scFastLine". However, in the NET component it seems that one must construct a unique fastline class, then use that name to add to the chart.

Example:
//Prepare chart
this.tChart1.Series.Clear(true);
Steema.TeeChart.Styles.FastLine fastline1 = new Steema.TeeChart.Styles.FastLine();
Steema.TeeChart.Styles.FastLine fastline2 = new Steema.TeeChart.Styles.FastLine();
Steema.TeeChart.Styles.FastLine fastline3 = new Steema.TeeChart.Styles.FastLine();
for (int i = 0; i < intSegmentCnt; i++)
{
string strCnt = Convert.ToString(i + 1);
string strLineName = "fastline" + Convert.ToString(i * 3);

this.tChart1.Series.Add(fastline1);
this.tChart1.Series[i * 3].Title = "BIE" + strCnt;
this.tChart1.Series[i * 3].VertAxis = Steema.TeeChart.Styles.VerticalAxis.Left;

this.tChart1.Series.Add(fastline2);
this.tChart1.Series[(i * 3) + 1].Title = "EVM" + strCnt;
this.tChart1.Series[(i * 3) + 1].VertAxis = Steema.TeeChart.Styles.VerticalAxis.Left;

this.tChart1.Series.Add(fastline3);
this.tChart1.Series[(i * 3) + 2].Title = "PWR" + strCnt;
this.tChart1.Series[(i * 3) + 2].VertAxis = Steema.TeeChart.Styles.VerticalAxis.Right;
}

This works on the first pass through the loop, but on the second pass the fastline types are invalid.

Any hints?

Regards,
Mark

Posted: Fri Jun 05, 2009 8:44 am
by 10050769
Hello MarkR,


I recomend that delete or coment this lines of your code:

Out of For:

Code: Select all

Steema.TeeChart.Styles.FastLine fastline1 = new Steema.TeeChart.Styles.FastLine();
Steema.TeeChart.Styles.FastLine fastline2 = new Steema.TeeChart.Styles.FastLine();
Steema.TeeChart.Styles.FastLine fastline3 = new Steema.TeeChart.Styles.FastLine(); 

In of For

Code: Select all

this.tChart1.Series.Add(fastline1); 
this.tChart1.Series.Add(fastline2); 
this.tChart1.Series.Add(fastline3); 
And change previous lines for next code in for and checked that works fine in your application :

Code: Select all

  new Steema.TeeChart.Styles.FastLine(tChart1.Chart);
  new Steema.TeeChart.Styles.FastLine(tChart1.Chart);
  new Steema.TeeChart.Styles.FastLine(tChart1.Chart);
I hope that will helps.

Thanks,

Posted: Fri Jun 05, 2009 12:42 pm
by 15653335
Sandra,

Thank you very much! I had figured that I was missing the proper (elegant) syntax for getting this accomplished, I was performing it the brute force method.

Also, thank you for the exceptionally fast reply. THIS IS THE SECOND REASON WHY I LOVE THE STEEMA PRODUCTS! The first is that tChart is an excellent product. :)

Regards,
Mark

Posted: Mon Jun 08, 2009 9:18 am
by 10050769
Hello MarkR,


You are welcome :D.


Thanks,