Hi,
I have a number of series on my chart, but I don't display all the series in the chart's legend. I also have checkboxes enabled on the legend. Users can also add series to the chart - some of which will be displayed in the legend and some not.
I am trying to find a link between the items in the legend and their corresponding indices in the chart's series collection.
By way of illustration:
The following series exist on the chart:
Idx.
0 - Price
1 - Moving Average
3 - Bollinger band upper series
4 - Bollinger band lower series
5 - Moving Average #2
6 - MA #2's Bollinger upper series
7 - MA #2's Bollinger lower series
The following series are displayed in the legend:
Leg. Idx.
0 - Moving Average
1 - Bollinger upper series
2 - MA 2
3 - MA 2's Bollinger upper series
Each set of Bollinger bands (2 series) is represented by one legend item, so that the set can be activated/deactivated by one checkbox.
What I would ideally like to do in the ClickLegend handler is check whether the item clicked was a Bollinger band and if so, retrieve it's index in the chart's series collection so that whatever action is performed on the series will also be performed on it's 'partner' series, the Bollinger lower series which will always be at the next position.
I can retrieve the Legend index for the clicked item and I can also 'work with' it's corresponding series via tChart1.Chart.SeriesLegend(LegendIndex,false), but I can't retrieve the actual series index.
JGM
Need a link between legend and chart series
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Hi JGM,
You can try using something like this:
Or just:
You can try using something like this:
Code: Select all
if (tChart1[tChart1.Series.IndexOf(tChart1.Chart.SeriesLegend(LegendIndex,false))] is Steema.TeeChart.Functions.Bollinger)
{
//Your code here
}
Code: Select all
if (tChart1.Chart.SeriesLegend(LegendIndex,false) is Steema.TeeChart.Functions.Bollinger)
{
//Your code here
}
Best Regards,
Narcís Calvet / 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 |