This question is locked. New answers and comments are not allowed.
Hello,
I have the following situation:
I am creating a dynamic number of bar/line series using the SeriesProvider class.
Unfortunately there does not seem to be a way to define a custom label definition within this class so I am waiting until the Loaded event is fired on my chart and trying to do it programmatically.
Which results in the following stack trace in Chrome when the chart tries to render. For some reason I can't intercept this exception in Visual studio.
Uncaught Error: Unhandled Error in Silverlight Application Code: 4004 Category: ManagedRuntimeError Message: System.NullReferenceException: Object reference not set to an instance of an object. at Telerik.Windows.Controls.ChartView.ChartSeries.GetLabelVisual(ChartSeriesLabelUpdateContext context) at Telerik.Windows.Controls.ChartView.ChartSeries.ProcessLabelDefinition(ChartSeriesLabelUpdateContext context) at Telerik.Windows.Controls.ChartView.ChartSeries.ProcessDataPointLabels(ChartSeriesLabelUpdateContext context) at Telerik.Windows.Controls.ChartView.ChartSeries.UpdateLabels(ChartLayoutContext context) at Telerik.Windows.Controls.ChartView.ChartSeries.UpdateUICore(ChartLayoutContext context) at Telerik.Windows.Controls.ChartView.PointTemplateSeries.UpdateUICore(ChartLayoutContext context) at Telerik.Windows.Controls.ChartView.BarSeries.UpdateUICore(ChartLayoutContext context) at Telerik.Windows.Controls.ChartView.PresenterBase.UpdateUI(ChartLayoutContext context) at Telerik.Windows.Controls.ChartView.RadChartBase.UpdateUICore(ChartLayoutContext context) at Telerik.Windows.Controls.ChartView.PresenterBase.UpdateUI(ChartLayoutContext context) at Telerik.Windows.Controls.ChartView.RadChartBase.CallUpdateUI() at Telerik.Windows.Controls.ChartView.RadChartBase.ArrangeOverride(Size finalSize) at System.Windows.FrameworkElement.ArrangeOverride(IntPtr nativeTarget, Single inWidth, Single inHeight, Single& outWidth, Single& outHeight)
Any thoughts?
Colter
I have the following situation:
I am creating a dynamic number of bar/line series using the SeriesProvider class.
Unfortunately there does not seem to be a way to define a custom label definition within this class so I am waiting until the Loaded event is fired on my chart and trying to do it programmatically.
RadCartesianChart cartesianChart = chart as RadCartesianChart;if (cartesianChart != null){ // add label definitions since our chart series are created dynamically by Series Providers ChartSeriesLabelDefinition cartesianLabelDefintion = new ChartSeriesLabelDefinition(); // Grab the data template from the resources if (Resources.Contains(CartesianLabelTemplateName)) { DataTemplate labelTemplate = Resources[CartesianLabelTemplateName] as DataTemplate; if (labelTemplate != null) { cartesianLabelDefintion.Template = labelTemplate; } } // Default to a property binding if no template is found if(cartesianLabelDefintion.Template == null) { cartesianLabelDefintion.Binding = new PropertyNameDataPointBinding("FormattedValue"); } cartesianChart.Series.ForEach(s => { s.LabelDefinitions.Add(cartesianLabelDefintion); });}Which results in the following stack trace in Chrome when the chart tries to render. For some reason I can't intercept this exception in Visual studio.
Uncaught Error: Unhandled Error in Silverlight Application Code: 4004 Category: ManagedRuntimeError Message: System.NullReferenceException: Object reference not set to an instance of an object. at Telerik.Windows.Controls.ChartView.ChartSeries.GetLabelVisual(ChartSeriesLabelUpdateContext context) at Telerik.Windows.Controls.ChartView.ChartSeries.ProcessLabelDefinition(ChartSeriesLabelUpdateContext context) at Telerik.Windows.Controls.ChartView.ChartSeries.ProcessDataPointLabels(ChartSeriesLabelUpdateContext context) at Telerik.Windows.Controls.ChartView.ChartSeries.UpdateLabels(ChartLayoutContext context) at Telerik.Windows.Controls.ChartView.ChartSeries.UpdateUICore(ChartLayoutContext context) at Telerik.Windows.Controls.ChartView.PointTemplateSeries.UpdateUICore(ChartLayoutContext context) at Telerik.Windows.Controls.ChartView.BarSeries.UpdateUICore(ChartLayoutContext context) at Telerik.Windows.Controls.ChartView.PresenterBase.UpdateUI(ChartLayoutContext context) at Telerik.Windows.Controls.ChartView.RadChartBase.UpdateUICore(ChartLayoutContext context) at Telerik.Windows.Controls.ChartView.PresenterBase.UpdateUI(ChartLayoutContext context) at Telerik.Windows.Controls.ChartView.RadChartBase.CallUpdateUI() at Telerik.Windows.Controls.ChartView.RadChartBase.ArrangeOverride(Size finalSize) at System.Windows.FrameworkElement.ArrangeOverride(IntPtr nativeTarget, Single inWidth, Single inHeight, Single& outWidth, Single& outHeight)
Any thoughts?
Colter
