/// <summary> /// Fill in the list of the data source members. /// </summary> /// <param name="context">Descriptor context.</param> /// <returns>Standart values collection.</returns> public override StandardValuesCollection GetStandardValues(ITypeDescriptorContext context) { ArrayList values = new ArrayList(); Chart chart = ConverterHelper.GetChartFromContext(context); object dataSource = null; if (chart != null) { if (chart != null && ChartImage.IsValidDataSource(chart.DataSource)) { dataSource = chart.DataSource; } // Check if it's Y values member bool usedForYValues = false; if (context.PropertyDescriptor != null && context.PropertyDescriptor.Name == "YValueMembers") { usedForYValues = true; } // Populate list with all members names ArrayList memberNames = ChartImage.GetDataSourceMemberNames(dataSource, usedForYValues); foreach (string name in memberNames) { values.Add(name); } values.Add("(none)"); } return(new StandardValuesCollection(values)); }
internal virtual ArrayList GetMemberNames() { object dataSource = null; if (ChartWinDesigner.controlDesigner != null) { dataSource = ChartWinDesigner.controlDesigner.GetControlDataSource(_chart); } // Get list of members if (dataSource != null) { return(ChartImage.GetDataSourceMemberNames(dataSource, this.usedForYValue)); } return(new ArrayList()); }
public override StandardValuesCollection GetStandardValues(ITypeDescriptorContext context) { ArrayList arrayList = new ArrayList(); if (context != null && context.Instance != null) { IServiceContainer serviceContainer = null; if (context.Instance is Series && ((Series)context.Instance).serviceContainer != null) { serviceContainer = ((Series)context.Instance).serviceContainer; } if (serviceContainer == null && context.Instance is Array) { Array array = (Array)context.Instance; if (array.Length > 0 && array.GetValue(0) is Series) { serviceContainer = ((Series)array.GetValue(0)).serviceContainer; } } if (serviceContainer == null && context.Instance is Chart) { serviceContainer = ((Chart)context.Instance).serviceContainer; } if (serviceContainer != null) { ChartImage chartImage = (ChartImage)serviceContainer.GetService(typeof(ChartImage)); if (chartImage != null) { object dataSource = null; bool usedForYValue = false; if (context.PropertyDescriptor != null && context.PropertyDescriptor.Name == "ValueMembersY") { usedForYValue = true; } ArrayList dataSourceMemberNames = ChartImage.GetDataSourceMemberNames(dataSource, usedForYValue); foreach (string item in dataSourceMemberNames) { arrayList.Add(item); } arrayList.Add("(none)"); } } } return(new StandardValuesCollection(arrayList)); }