I have this code
chartText.Row = chartText.Column = -2;
chartText.ItemFormatString = "<DATA_VALUE:0>";
ctrlUltraChart.ColumnChart.ChartText.Add(chartText);
but the hard coded reference to ColumnChart will not work for me since I let the user select the chart type, is there any way to set the chart text and let the user select the chart type? Thank you, Jamie
Try using reflection to get the ChartTypeAppearance property based on the current chart type:PropertyInfo chartAppearancePoperty = ultraChart1.GetType().GetProperty(ultraChart1.ChartType.ToString());if (chartAppearancePoperty != null){ ChartTypeAppearance chartAppearance = chartAppearancePoperty.GetValue(ultraChart1, null) as ChartTypeAppearance; PropertyInfo chartTextProperty = chartAppearance.GetType().GetProperty("ChartText"); if (chartTextProperty != null) { ChartTextCollection chartTextCollection = chartTextProperty.GetValue(chartAppearance, null) as ChartTextCollection; if (chartTextCollection != null) { chartTextCollection.Add(myChartText); } }}
Exactly what I needed, thank you for your help. Jamie