Dynamically Adding Fastline Series?
Posted: Fri Jun 05, 2009 4:47 am
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
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