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

12 posts, 0 answers
  1. MB
    MB avatar
    23 posts
    Member since:
    Aug 2007

    Posted 15 Oct 2009 Link to this post

    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)
  2. Ves
    Admin
    Ves avatar
    2879 posts

    Posted 20 Oct 2009 Link to this post

    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.
  3. DevCraft banner
  4. MB
    MB avatar
    23 posts
    Member since:
    Aug 2007

    Posted 21 Oct 2009 Link to this post

    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.
  5. Ves
    Admin
    Ves avatar
    2879 posts

    Posted 27 Oct 2009 Link to this post

    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.
  6. Siew Fai Hoy
    Siew Fai Hoy avatar
    12 posts
    Member since:
    Sep 2009

    Posted 09 Nov 2009 Link to this post

    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.
  7. Ves
    Admin
    Ves avatar
    2879 posts

    Posted 11 Nov 2009 Link to this post

    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.
  8. Vinod Sardar
    Vinod Sardar avatar
    33 posts
    Member since:
    Nov 2009

    Posted 10 Dec 2009 Link to this post

    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.
  9. Ves
    Admin
    Ves avatar
    2879 posts

    Posted 11 Dec 2009 Link to this post

    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.
  10. NS
    NS avatar
    179 posts
    Member since:
    Jan 2007

    Posted 12 Feb 2010 Link to this post

    Hi,
    Is there any update on a solution for this ?

    Thanks,
    Nicolas
  11. NS
    NS avatar
    179 posts
    Member since:
    Jan 2007

    Posted 12 Feb 2010 Link to this post

    It seems to be solved in the 1314 build.

    Thanks,
    Nicolas
  12. Divyang
    Divyang avatar
    13 posts
    Member since:
    Dec 2010

    Posted 17 Mar 2011 Link to this post

    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 ?
  13. Ves
    Admin
    Ves avatar
    2879 posts

    Posted 22 Mar 2011 Link to this post

    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
Back to Top
DevCraft banner