/// <summary> /// Fill in the list of chart type names. /// </summary> /// <param name="context">Descriptor context.</param> /// <returns>Standard values collection.</returns> public override StandardValuesCollection GetStandardValues(ITypeDescriptorContext context) { ChartTypeRegistry registry = null; ArrayList values = new ArrayList(); Chart chart = ConverterHelper.GetChartFromContext(context); if (chart != null) { // Get chart type registry service registry = (ChartTypeRegistry)chart.GetService(typeof(ChartTypeRegistry)); if (registry != null) { // Enumerate all chart types names foreach (Object obj in registry.registeredChartTypes.Keys) { if (obj is string) { values.Add(obj); } } } else { throw (new InvalidOperationException(SR.ExceptionEditorChartTypeRegistryServiceInaccessible)); } } // Sort all values values.Sort(); return(new StandardValuesCollection(values)); }
/// <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)); }
/// <summary> /// Fill in the list of the chart areas for the series. /// </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); if (chart != null) { foreach (ChartArea area in chart.ChartAreas) { values.Add(area.Name); } } return(new StandardValuesCollection(values)); }