The Line.Smoothed property
Posted: Thu Jul 08, 2010 8:04 am
In the below code I see a strange occurance ..
I expected to have 1 extra series than I started with .. but when I set Smoothed to true I get another series ... does setting smoothed to true create another series as the result?
If so can I somehow delete the 'orignal' series so that I can get my series indexs back into sync with another part of the code that tracks each series ?
You see by the time I get to this code snippet ... I expected to have a series index = 0 (Candle Series) .. then Apply a simple Moving average and have 2 series .. alas I have 3 ... does this mean if I make a checkbox to switch smoothing on and off at runtime I will be dynamically changing the number of series in the collection. If I set smoothing does it add the "smoothed" series to end of the collection or does it insert the new "smoothed" series directly after the 'parent' series and thus I can never know the index of a series ?
regards Phil.
Code: Select all
int x = StockChart.Series.Count;
Line SMALine = new Line(StockChart.Chart);
MovingAverage SMAFunc = new MovingAverage();
SMALine.Function = SMAFunc;
SMALine.DataSource = StockChart.Series[ParentSeries];
SMALine.Function.Period = 4;
SMALine.Function.PeriodStyle = PeriodStyles.NumPoints;
SMALine.Smoothed = true;
x = StockChart.Series.Count;
If so can I somehow delete the 'orignal' series so that I can get my series indexs back into sync with another part of the code that tracks each series ?
You see by the time I get to this code snippet ... I expected to have a series index = 0 (Candle Series) .. then Apply a simple Moving average and have 2 series .. alas I have 3 ... does this mean if I make a checkbox to switch smoothing on and off at runtime I will be dynamically changing the number of series in the collection. If I set smoothing does it add the "smoothed" series to end of the collection or does it insert the new "smoothed" series directly after the 'parent' series and thus I can never know the index of a series ?
regards Phil.