This is a migrated thread and some comments may be shown as answers.

SeriesMapping CollectionIndex not working in SL4 RC Charts

11 Answers 244 Views
Chart
This is a migrated thread and some comments may be shown as answers.
Schneider
Top achievements
Rank 1
Schneider asked on 29 Mar 2010, 04:00 AM
I am binding my chart items source to ObservableCollection<DataServiceCollection<X>>   .... (DataServiceCollection is a WCF Data Services type that is based up ObservableCollection)

When I create the SeriesMappings, if I dont specify a CollectionIndex I get a null pointer exception and errors that it cannot bind to properties of X -- which is OK because its trying to bind on DataServiceCollection because I have not set a CollectionIndex.

If I try to do the correct thing and set CollectionIndex to 0, then when my SL application loads all I see is a white screen! I do not see the chart. I do not see any of my other GUI. I do not see any errors. I do not get any crashes. I just get nothing but a white screen. And yes the SL is loading, I can hit breakpoints.

This is using Telerik Silverlight RC with VS2010 RC and SL4 RC

What is going on here?

11 Answers, 1 is accepted

Sort by
0
Schneider
Top achievements
Rank 1
answered on 29 Mar 2010, 04:29 AM
Wow the more I use this the more I realise what a horrible piece of code it must be!

I have stopped using DataServiceCollection and just did a test with a manually created OC<List<X>> containing a single List.

That works fine if there is one SeriesMapping setup.

If I create a second (unused) series mapping then I get the white screen of death.

If I create second List in my OC, then I see the graph but it says "No data"

What on earth....
0
Schneider
Top achievements
Rank 1
answered on 29 Mar 2010, 05:29 AM
It appears that the chart shits itself if you DARE to create a SeriesMapping before there is a collection at the CollectionIndex,

And conversely if you remove a collection from the ItemSource BEFORE you remove the SeriesMapping for the collection... it shits itself.

Yay that means lots of complicated code to write. Thanks.

Any chance you could fix this to make it remotely sensible?
0
Schneider
Top achievements
Rank 1
answered on 31 Mar 2010, 02:07 AM
Heres a hint:

The chart should not crash just because one of the collections is empty.

It does.
0
Schneider
Top achievements
Rank 1
answered on 31 Mar 2010, 03:09 AM
Basically as it stands there is no way to build a chart with dynamic ItemsSource and SeriesMappings without writing some extremely complicated code.

Heres the facts:

- Exception if a collection in itemssource has no items
- Exception if collection removed from items source before series mapping removed
- White screen if collection added to itemssource without first adding series mapping

This turns something that should be so easy, into a total nightmare.

This scenario cannot possibly have been tested, and its not an unusual scenario (wanting to add/remove series from a graph)
0
Schneider
Top achievements
Rank 1
answered on 31 Mar 2010, 03:38 AM
Not to mention the fact that using an index for the collection bindings is dumb.

What happens when any collections are added or removed? Yes the indexes become invalid (it will crash of course) so you have to spend a lot of effort keeping them synchronized. Not to mention the exceptions i have already discussed above which multiply this complexity! In fact at this point you really have to consider ditching this product.

Pain....full
0
Schneider
Top achievements
Rank 1
answered on 31 Mar 2010, 05:20 AM
News update:

Additional Y axis does not seem to work either.

As usual you have to be very careful not to make any changes to the Axis at the wrong times or it crashes with this stack trace:

  Telerik.Windows.Controls.Charting!Telerik.Windows.Controls.Charting.Axis2D<Telerik.Windows.Controls.Charting.AxisYItem2D>.UpdateSlider(string propertyName = "AxisSliderSmallChange") + 0x13a bytes
  Telerik.Windows.Controls.Charting!Telerik.Windows.Controls.Charting.Axis2D<Telerik.Windows.Controls.Charting.AxisYItem2D>.ZoomScrollSettings_PropertyChanged(object sender = {Telerik.Windows.Controls.Charting.ZoomScrollSettings}, System.ComponentModel.PropertyChangedEventArgs e = {System.ComponentModel.PropertyChangedEventArgs}) + 0x3d bytes
  Telerik.Windows.Controls.Charting!Telerik.Windows.Controls.Charting.ZoomScrollSettings.OnPropertyChanged(System.ComponentModel.PropertyChangedEventArgs e = {System.ComponentModel.PropertyChangedEventArgs}) + 0x41 bytes
  Telerik.Windows.Controls.Charting!Telerik.Windows.Controls.Charting.ZoomScrollSettings.OnPropertyChanged(string propertyName = "AxisSliderSmallChange") + 0x4c bytes
  Telerik.Windows.Controls.Charting!Telerik.Windows.Controls.Charting.ZoomScrollSettings.AxisSliderSmallChange.set(double value = 0.10000000000000003) + 0x41 bytes
  Telerik.Windows.Controls.Charting!Telerik.Windows.Controls.Charting.Axis.UpdateAxisSliderChangeSteps() + 0x123 bytes
  Telerik.Windows.Controls.Charting!Telerik.Windows.Controls.Charting.Axis.BuildAxisData() + 0x1f6 bytes
  Telerik.Windows.Controls.Charting!Telerik.Windows.Controls.Charting.Axis.UpdateAxis() + 0x5d bytes
  Telerik.Windows.Controls.Charting!Telerik.Windows.Controls.Charting.Axis.ChartAreaDataChanged(object sender = {Telerik.Windows.Controls.Charting.ChartArea}, System.EventArgs e = {System.EventArgs}) + 0x22 bytes
  Telerik.Windows.Controls.Charting!Telerik.Windows.Controls.Charting.ChartArea.OnDataChanged() + 0x48 bytes
  Telerik.Windows.Controls.Charting!Telerik.Windows.Controls.Charting.ChartArea.UpdateChart() + 0xb8 bytes
  Telerik.Windows.Controls.Charting!Telerik.Windows.Controls.Charting.ChartArea.OnDataSeriesCollectionChanged(object sender = Count = 1, System.Collections.Specialized.NotifyCollectionChangedEventArgs e = {System.Collections.Specialized.NotifyCollectionChangedEventArgs}) + 0x69 bytes
  System.Windows.dll!System.Collections.ObjectModel.ObservableCollection<Telerik.Windows.Controls.Charting.DataSeries>.OnCollectionChanged(System.Collections.Specialized.NotifyCollectionChangedEventArgs e) + 0x37 bytes
  Telerik.Windows.Data!Telerik.Windows.Data.RadObservableCollection<Telerik.Windows.Controls.Charting.DataSeries>.OnCollectionChanged(System.Collections.Specialized.NotifyCollectionChangedEventArgs e = {System.Collections.Specialized.NotifyCollectionChangedEventArgs}) + 0x38 bytes
  Telerik.Windows.Data!Telerik.Windows.Data.RadObservableCollection<Telerik.Windows.Controls.Charting.DataSeries>.ResumeNotifications() + 0xbe bytes
  Telerik.Windows.Controls.Charting!Telerik.Windows.Controls.Charting.RadHierarchicalObservableCollection<Telerik.Windows.Controls.Charting.DataSeries>.AddRange(System.Collections.Generic.IEnumerable<Telerik.Windows.Controls.Charting.DataSeries> items = Count = 1) + 0x3d bytes
  Telerik.Windows.Controls.Charting!Telerik.Windows.Controls.RadChart.GenerateDataSeries(object originalData = Count = 2, Telerik.Windows.Controls.Charting.SeriesMappingCollection seriesMappings = Count = 1, Telerik.Windows.Controls.Charting.ChartArea chartArea = {Telerik.Windows.Controls.Charting.ChartArea}) + 0x275 bytes
  Telerik.Windows.Controls.Charting!Telerik.Windows.Controls.RadChart.GenerateDataSeries(object originalData = Count = 2) + 0x1c2 bytes
  Telerik.Windows.Controls.Charting!Telerik.Windows.Controls.RadChart.Rebind(object originalData = Count = 2) + 0xb7 bytes
  Telerik.Windows.Controls.Charting!Telerik.Windows.Controls.RadChart.Rebind() + 0x49 bytes
  Telerik.Windows.Controls.Charting!Telerik.Windows.Controls.RadChart.NotifyCollectionChanged(object sender = Count = 1, System.Collections.Specialized.NotifyCollectionChangedEventArgs e = {System.Collections.Specialized.NotifyCollectionChangedEventArgs}) + 0x22 bytes
  System.Windows.dll!System.Collections.ObjectModel.ObservableCollection<Telerik.Windows.Controls.Charting.SeriesMapping>.OnCollectionChanged(System.Collections.Specialized.NotifyCollectionChangedEventArgs e) + 0x37 bytes
  Telerik.Windows.Data!Telerik.Windows.Data.RadObservableCollection<Telerik.Windows.Controls.Charting.SeriesMapping>.OnCollectionChanged(System.Collections.Specialized.NotifyCollectionChangedEventArgs e = {System.Collections.Specialized.NotifyCollectionChangedEventArgs}) + 0x38 bytes
  System.Windows.dll!System.Collections.ObjectModel.ObservableCollection<System.__Canon>.InsertItem(int index, System.__Canon item) + 0x94 bytes
  Telerik.Windows.Data!Telerik.Windows.Data.RadObservableCollection<Telerik.Windows.Controls.Charting.SeriesMapping>.InsertItem(int index = 0, Telerik.Windows.Controls.Charting.SeriesMapping item = {Telerik.Windows.Controls.Charting.SeriesMapping}) + 0x97 bytes
  mscorlib.dll!System.Collections.ObjectModel.Collection<Telerik.Windows.Controls.Charting.SeriesMapping>.Add(Telerik.Windows.Controls.Charting.SeriesMapping item) + 0x69 bytes
> ReportViewer!ReportViewer.MainPage.UpdateSeriesMappings() Line 63 + 0x20 bytes C#

So I got around that by only changing the YAxis after any changes to the itemssource are made.

Then I get another problem... once I start using the AxisName property to correlated the series to the correct Y Axis.... what it renders simple not right. Everything just goes into one flat line along the bottom of the graph - the Y Axis are labelled but have no values on them. Oh god what next....

0
Ves
Telerik team
answered on 31 Mar 2010, 10:59 AM
Hi Schneider,

The problems with SeriesMappings you mentioned are addressed in the latest internal build (version 2010.1.326). Please, download it and give it a try.

As for the additional Y axes -- I am afraid I could not really get the scenario that triggers this behavior. Can you please provide more details? Thanks.

Regards,
Ves
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.
0
Allan D. Jensen
Top achievements
Rank 2
answered on 29 Apr 2010, 12:43 PM
I use WPF version 2010.1.422.35, but I still have a problem to create an instance of SeriesMapping i.e. Dim seriesMapping As New SeriesMapping() . In run time I got a pop up that says: There is no source code available for the current location
0
Ves
Telerik team
answered on 04 May 2010, 09:25 AM
Hello Allan,

I was only able to reproduce this when trying to debug the code with "Step Into (F11)" into the SeriesMapping  constructor. Still, running the code or using "Step Over (F10)" does not produce this problem.  I verified that there is no first chance exception, so please use F10 while our developers investigate the problem.

Best regards,
Ves
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.
0
Colm
Top achievements
Rank 1
answered on 13 Oct 2010, 03:54 PM
Hi,
I am having the same issues with the chart, namely I can't blend when the series mapping is bound as I get an exception thrown on construction. In addition, at runtime, if the seriesmapping isn't set, I get a white screen hang of silverlight.

I'm using 2010.2.924.1040.

Here's the error I get in Cider:
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)


The XAML I'm using:
<views:RendererViewBase x:Class="Automsoft.nuaViews.Views.Renderers.ChartRenderer"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
             xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation"
             xmlns:telerikChart="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls.Charting"
             xmlns:telerikCharting="clr-namespace:Telerik.Windows.Controls.Charting;assembly=Telerik.Windows.Controls.Charting"
             xmlns:views="clr-namespace:Automsoft.nuaViews.Views"
             mc:Ignorable="d"
             DataContext="{Binding ViewModelChartRenderer, Source={StaticResource Locator}}">
    <Grid x:Name="LayoutRoot">
        <views:RendererDecorator x:Name="Container">
            <views:RendererDecorator.ContentArea>
                <telerikChart:RadChart telerik:StyleManager.Theme="Windows7"
                                       ItemsSource="{Binding Path=SeriesData, Mode=OneWay}"
                                       SeriesMappings="{Binding Path=SeriesMappings, Mode=OneWay}">
                    <telerik:RadChart.DefaultView>
                        <telerik:ChartDefaultView>
                            <telerik:ChartDefaultView.ChartTitle>
                                <telerik:ChartTitle  FontFamily="{Binding TitleFont.FontFamily}"
                                                     FontSize="{Binding TitleFont.FontSize}"
                                                     Foreground="{Binding TitleFont.FontColor}"
                                                     FontStyle="{Binding TitleFont.FontStyle}"
                                                     FontWeight="{Binding TitleFont.FontWeight}"
                                                     Content="{Binding Title}"/>
                            </telerik:ChartDefaultView.ChartTitle>
                            <telerik:ChartDefaultView.ChartLegend>
                                <telerik:ChartLegend/>
                            </telerik:ChartDefaultView.ChartLegend>
                            <telerik:ChartDefaultView.ChartArea>
                                <telerik:ChartArea AdditionalYAxes="{Binding AdditionalYAxes, Mode=OneWay}">
                                    <telerik:ChartArea.AxisX>
                                        <telerik:AxisX Title="{Binding XAxisTitle}"
                                                       AutoRange="{Binding XAxisAutoScale}"
                                                       IsDateTime="{Binding XAxisIsDateTime}"
                                                       MinValue="{Binding XAxisMinimumScale}"
                                                       MaxValue="{Binding XAxisMaximumScale}"
                                                       LayoutMode="Inside"
                                                       StepLabelLevelCount="2" />
                                    </telerik:ChartArea.AxisX>
                                </telerik:ChartArea>
                            </telerik:ChartDefaultView.ChartArea>
                        </telerik:ChartDefaultView>
                    </telerik:RadChart.DefaultView>
                </telerikChart:RadChart>
            </views:RendererDecorator.ContentArea>
        </views:RendererDecorator>
    </Grid>
</views:RendererViewBase>

0
Ves
Telerik team
answered on 15 Oct 2010, 04:37 PM
Hi Colm,

I can confirm, there is an issue in this very scenario -- binding the series mappings. It has already been logged and our developers are after it, the fix will be available in the next internal build. Please, accept our apologies for the inconvenience caused.

Best regards,
Ves
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
Tags
Chart
Asked by
Schneider
Top achievements
Rank 1
Answers by
Schneider
Top achievements
Rank 1
Ves
Telerik team
Allan D. Jensen
Top achievements
Rank 2
Colm
Top achievements
Rank 1
Share this question
or