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

Pie/Doughnut Charts - Value does not fall within the expected range

11 Answers 165 Views
Chart
This is a migrated thread and some comments may be shown as answers.
MB
Top achievements
Rank 1
MB asked on 15 Oct 2009, 04:13 PM
Hello,

When I set the content of a control to a RadChart created in code behind, it works in all cases except with the Pie and Doughnut chart.

The issue is nearly identical to the one posted here:
http://www.visifire.com/forums/lofiversion/index.php/t832.html

I tried to create a sample project to reproduce but it has been quite difficult (meaning it seems to work in this simple standalone project)... I am not sure what is causing this error in the one project.  I have eliminated styles, etc., it has not helped.
 
There is no stack trace given with this exception, eventually the silverlight window goes into overflow and WSOD.  The error occurs sporadically after the content is set (so it is not something that can be debugged).

I will keep trying to create a sample to reproduce but was also hoping this may be a known issue or there could be a workaround.

To try to troubleshoot this I took a guess that it was the MeasureOveride and it turned out that was correct.  I can catch the exception here on the added chart, however, nothing I seem to do can actually handle it.  FYI - the availableSize is {0, 0}

    public class RadChartM : RadChart  
    {  
        protected override Size MeasureOverride(Size availableSize)  
        {  
            try  
            {  
                return base.MeasureOverride(availableSize);  
            }  
            catch (Exception ex)  
            {  
                Debug.WriteLine(ex.ToString());  
                return new Size(this.ActualWidth,this.ActualHeight);  
            }  
        }  
    } 

Exception:
System.ArgumentException: Value does not fall within the expected range.
at MS.Internal.XcpImports.CheckHResult(UInt32 hr)
at MS.Internal.XcpImports.FrameworkElement_MeasureOverride(FrameworkElement element, Size availableSize)
at System.Windows.FrameworkElement.MeasureOverride(Size availableSize)
at Telerik.Windows.Controls.RadChart.MeasureOverride(Size availableSize)
at RadChartM.MeasureOverride(Size availableSize)

11 Answers, 1 is accepted

Sort by
0
Ves
Telerik team
answered on 20 Oct 2009, 12:08 PM
Hi Mark,

I am afraid we have not been able to reproduce this issue so far. Please, let us know if you find any specific detail that seems to be causing the issue or if you successfully isolate the issue in a sample.

Kind regards,
Ves
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
MB
Top achievements
Rank 1
answered on 22 Oct 2009, 02:08 AM
I can reproduce this very easily in our master project but have not been able to repro in a small isolated project.  I keep adding more parts to the isolated project to find out what combination creates the issue, but it's time consuming.

I have tried various things within the project to work around the issue. 
e.g.
- naming the chart (unique generated name) - same error
- adding the chart to a grid, then setting the content to the grid (same error)
- set the chart visibility to collapsed, then set the content to the chart (ok) then set visibility to visible (crash)
- set the content using Dispatcher.BeginInvoke, same error
- suppressing the exception in MeasureOverride (impossible)
- using an empty List<T> for the ItemsSource (works - but displays "No Data Series" - so useless)

What is the strangest is that the error happens recursively and endlessly until the app dies, there is no way to handle or suppress.  Again, all other chart types are working fine.
0
Ves
Telerik team
answered on 27 Oct 2009, 07:21 AM
Hello Mark,

I understand it might not be easy to isolate the issue. Here is another suggestion -- you can start stripping the project down, even cutting functionality you need, providing fake data, etc. until you reach a point at which the chart works fine. This way you may spot the exact reason for the problem. Let us know if you manage to find a specific reason for this behavior.

Best regards,
Ves
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Siew Fai Hoy
Top achievements
Rank 1
answered on 09 Nov 2009, 06:05 AM
Hello,

I would like to add myself to the discussion here.
I've the same problem as mentioned here with a Pie chart. 
My C# solution is similar to that of Sales Dashboard demo with one of the Modules containing a view with a Pie chart and nothing else, the View is injected in designated region contained in a ContentControl.

The Pie Chart renders correctly in the following 2 separate scenarios:
  1. The Series Mappings, Item Mappings and etc are added via Code Behind.  The XAML for this contains only a RadChart declaration like most of the examples on your website.
  2. There are no code in code behind, ItemsSource is bound to view model, and Series Mappings and Item Mappings are declared in XAML but uses default layout.

It doesn't work for me when I don't use default layout , i.e. have a Grid with 3 rows, ChartTitle, ChartArea and ChartLegend each occupying a row in that Grid.  There is no code behind and view model provides the data, Series Mappings and Item Mappings are declared in XAML.

Compiling this as a separate app without Unity works without a glitch.

Regards.
0
Ves
Telerik team
answered on 11 Nov 2009, 12:24 PM
Hello Siew Fai Hoy,

Feel free to open a formal support ticket and attach a project, where we can reproduce this. We will investigate it and get back to you with our findings.

Sincerely,
Ves
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Vinod Sardar
Top achievements
Rank 1
answered on 10 Dec 2009, 12:21 PM
Error is reproducible for following code:

I could reproduce it when all the YValues are Zero. As in Below Case Chart Data is Zero for X and Y group.

//Please assume some code. below code is just for reference.

 

public MainPage()

 

{

InitializeComponent();

RefreshGraph();

}

 

private void RefreshGraph()

 

{

RadChart1.DefaultSeriesDefinition =

new PieSeriesDefinition();// { DefaultLabelFormat = "#%{p1}" };

 

 

SeriesMapping sm = new SeriesMapping();

 

sm.ItemMappings.Add(

new ItemMapping("YValue", DataPointMember.YValue));

 

sm.ItemMappings.Add(

new ItemMapping("Name", DataPointMember.LegendLabel));

 

 

List<ChartData> data = new List<ChartData>()

 

{

 

new ChartData(0,"X"),

 

 

new ChartData(0,"Y")//,

 

 

//new ChartData(27),

 

 

//new ChartData(15),

 

 

//new ChartData(29)

 

};

RadChart1.SeriesMappings.Add(sm);

RadChart1.ItemsSource = data;

}


Thanks,
Vinod Sa.
0
Ves
Telerik team
answered on 11 Dec 2009, 11:30 AM
Hello Vinod,

Thanks for the details. This seems to happen only when all the pie/doughnut items have YValue=0. This case is not well defined as RadChart should calculate the part for each item (which is 0) out of the sum of all items (which is 0 too). I will forward your feedback to our developers, so they can consider how to improve RadChart behavior in this case. Your Telerik points have been updated.

Best regards,
Ves
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
NS
Top achievements
Rank 1
answered on 12 Feb 2010, 07:11 AM
Hi,
Is there any update on a solution for this ?

Thanks,
Nicolas
0
NS
Top achievements
Rank 1
answered on 12 Feb 2010, 07:24 AM
It seems to be solved in the 1314 build.

Thanks,
Nicolas
0
Divyang
Top achievements
Rank 1
answered on 17 Mar 2011, 04:45 PM
Hi,

We are facing the same problem in 1314 build.

We have all fields with 0 on YValue and creating two custom line with on chart area with value=0 and value=122. When we execute application it throws "Value does not fall within the expected range" exception. We are using 2010.3.1314.1040 Telerik silverlight controls.

Could you please help me on this ?
0
Ves
Telerik team
answered on 22 Mar 2011, 02:14 PM
Hello Divyang,

Can you provide us with a small sample, reproducing the issue? Once we review it, we will get back to you with our findings. Thanks.

Regards,
Ves
the Telerik team
Tags
Chart
Asked by
MB
Top achievements
Rank 1
Answers by
Ves
Telerik team
MB
Top achievements
Rank 1
Siew Fai Hoy
Top achievements
Rank 1
Vinod Sardar
Top achievements
Rank 1
NS
Top achievements
Rank 1
Divyang
Top achievements
Rank 1
Share this question
or