Possible to bind to SeriesMapping?

6 posts, 0 answers
  1. Bryce
    Bryce avatar
    32 posts
    Member since:
    Aug 2010

    Posted 11 Oct 2010 Link to this post

    I have a chart thats trying to bind to my MVVM and I keep getting an exception inside the radchart from my seriesmapping binding, since as soon as I remove that binding the exception stops throwing.

    Object reference not set to an instance of an object.
       at Telerik.Windows.Controls.RadChart.ClearDataSeries() in c:\Builds\WPF_Scrum\Release_SL_2010_Q2_SP2\Sources\Development\Controls\Chart\Chart\RadChart.cs:line 1032
       at Telerik.Windows.Controls.RadChart.Rebind(Object originalData) in c:\Builds\WPF_Scrum\Release_SL_2010_Q2_SP2\Sources\Development\Controls\Chart\Chart\RadChart.cs:line 1014
       at Telerik.Windows.Controls.RadChart.ItemsSourcePropertyChanged(DependencyObject target, DependencyPropertyChangedEventArgs args) in c:\Builds\WPF_Scrum\Release_SL_2010_Q2_SP2\Sources\Development\Controls\Chart\Chart\RadChart.cs:line 852
       at Telerik.Windows.PropertyMetadata.<>c__DisplayClass1.<Create>b__0(DependencyObject d, DependencyPropertyChangedEventArgs e) in c:\Builds\WPF_Scrum\Release_SL_2010_Q2_SP2\Sources\Development\Core\Controls\Common\System.Windows\PropertyMetadata.cs:line 200
       at System.Windows.DependencyObject.RaisePropertyChangeNotifications(DependencyProperty dp, Object oldValue, Object newValue)
       at System.Windows.DependencyObject.UpdateEffectiveValue(DependencyProperty property, EffectiveValueEntry oldEntry, EffectiveValueEntry& newEntry, ValueOperation operation)
       at System.Windows.DependencyObject.SetValueInternal(DependencyProperty dp, Object value, Boolean allowReadOnlySet)
       at Telerik.Windows.Controls.RadChart.set_ItemsSource(Object value) in c:\Builds\WPF_Scrum\Release_SL_2010_Q2_SP2\Sources\Development\Controls\Chart\Chart\RadChart.cs:line 479
       at Telerik.Windows.Controls.RadChart.InitializeDesignTimeData() in c:\Builds\WPF_Scrum\Release_SL_2010_Q2_SP2\Sources\Development\Controls\Chart\Chart\RadChart.cs:line 1131
       at Telerik.Windows.Controls.RadChart.OnApplyTemplate() in c:\Builds\WPF_Scrum\Release_SL_2010_Q2_SP2\Sources\Development\Controls\Chart\Chart\RadChart.cs:line 716
       at System.Windows.FrameworkElement.OnApplyTemplate(IntPtr nativeTarget)

    <telerikChart:RadChart ItemsSource="{Binding StorageOpsPerSecond}" BorderThickness="0" Controls:StyleManager.Theme="Windows7"
                                                           Height="300" Margin="3 0 3 0" SeriesMappings="{Binding StorageOpsSeriesMapping, Mode=OneWay}">
                                        <telerikCharting:ChartDefaultView ChartLegendPosition="Bottom">
                                                <telerikCharting:ChartTitle HorizontalContentAlignment="Stretch" Content="Storage Operations Per Second"/>
                                                    <telerikCharting:ChartLegend x:Name="chartLegend"/>
                                                    <telerikCharting:ChartArea LegendName="chartLegend" EnableAnimations="True">
                                                            <telerikCharting:AxisX LayoutMode="Normal" IsDateTime="True" DefaultLabelFormat="h:mm" AutoRange="True" 
                                                                       LabelRotationAngle="60" LabelStep="1" TicksDistance="15"/>

    public class StorageServiceViewModel: ServiceViewModelBase
        public List<AzProduct> Products {get; set;}
        public ObservableCollection<AddRangeObservableCollection<DataPointViewModel>> StorageOpsPerSecond { get; private set; }
        public List<SeriesMapping> StorageOpsSeriesMapping
             get {return Products.Select((t, i) => GetSeriesMapping(i, t.DisplayName)).ToList();}
        public StorageServiceViewModel(IAuthenticateService authService, ICustomerService customerService, IMonitorHistoryService monHistoryService, IMonitorCurrentService monCurrentService)
            : base(authService, customerService, monHistoryService, monCurrentService)
            StorageOpsPerSecond = new ObservableCollection<AddRangeObservableCollection<DataPointViewModel>>();
                Products =customerService.GetProducts(Guid.Empty);
        public override void LoadData()
            foreach (AzProduct product in Products)
                StorageProductViewModel spvm = new StorageProductViewModel(product, MonitorCurrentService,
        public override void LoadProducts(List<AzProduct> products)
            foreach(AzProduct product in products)
                if(product.Type == ProductTypes.EMC || product.Type == ProductTypes.NetApp)
        private SeriesMapping GetSeriesMapping(int index, string displayName)
            SeriesMapping mapping = new SeriesMapping();
            mapping.CollectionIndex = index;
            mapping.LegendLabel = displayName;
            LineSeriesDefinition lsd = new LineSeriesDefinition();
            lsd.ShowItemLabels = false;
            lsd.ShowPointMarks = false;
            lsd.ShowItemToolTips = true;
            lsd.ItemToolTipFormat = "#Y";
            mapping.SeriesDefinition = lsd;
            ItemMapping im = new ItemMapping();
            im.FieldName = "Timestamp";
            im.DataPointMember = DataPointMember.XValue;
            im = new ItemMapping();
            im.FieldName = "Value";
            im.DataPointMember = DataPointMember.YValue;
            return mapping;
  2. Yavor
    Yavor avatar
    401 posts

    Posted 14 Oct 2010 Link to this post

    Hi Bryce,

    Thank you for reporting this bug! We reproduced this issue and it is logged in our system here. Our developers fixed it immediately and you will be able to get the fix with the next LIB. This issue is caused by the SeriesMappings being null when you try to set the ItemsSouce. Please, excuse us for the inconvenience. We have added points to your account for helping us pinpoint this issue. Don't hesitate to contact us if you have other questions.

    Kind regards,
    Yavor Ivanov
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  3. Ingo
    Ingo avatar
    1 posts
    Member since:
    Sep 2010

    Posted 19 Jan 2011 Link to this post

    Hi Yavor,

    I have a problem which seems to be quite similar to the one described above. At the moment I can't really find a bug in my code. Maybe I need new glasses.....

    You wrote that there should be a fix available with the next Lib - so, is this problem already fixed with the Version 2010.3.1314 (in the PITS it is
    marked as resolved but not scheduled)? As I have already the version installed then there may be a new issue altogether then?

    Thanks for your help, it is dearly appreciated!

    Kind regards,

  4. Giuseppe
    Giuseppe avatar
    2363 posts

    Posted 24 Jan 2011 Link to this post

    Hello Ingo,

    The original issue mentioned in this forum thread was fixed 3 months ago so probably you are experiencing a different problem. We would suggest you to open a formal support ticket and send us a runnable sample application that we can investigate locally so we can advise you properly how to proceed.

    the Telerik team
    Let us know about your Windows Phone 7 application built with RadControls and we will help you promote it. Learn more>>
  5. Jurie
    Jurie avatar
    6 posts
    Member since:
    Feb 2009

    Posted 27 Jan 2011 Link to this post

    Using the same code in version 2010.3.1314.1040 gives you the following error:

    Message: 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.RadChart.AssociateSeriesMappingsWithChartArea()
       at Telerik.Windows.Controls.RadChart.Rebind(Object originalData)
       at Telerik.Windows.Controls.RadChart.Rebind()
       at Telerik.Windows.Controls.RadChart.InternalRebind()
       at Telerik.Windows.Controls.RadChart.OnApplyTemplate()
       at System.Windows.FrameworkElement.OnApplyTemplate(IntPtr nativeTarget)     

    I tried adding a chartname, and then adding 
                mapping.ChartAreaName = "chartName";

    Still same error.
  6. Giuseppe
    Giuseppe avatar
    2363 posts

    Posted 28 Jan 2011 Link to this post

    Hi Jurie,

    Find attached a sample application that demonstrates RadChart.SeriesMappings bindings.

    Should your problem persist, please open a formal support ticket and send us a runnable sample application that we can investigate locally and advise you how to proceed.

    Kind regards,
    the Telerik team
    Let us know about your Windows Phone 7 application built with RadControls and we will help you promote it. Learn more>>
Back to Top