Overflow exception in LinearAxisModel

9 posts, 0 answers
  1. Brannon
    Brannon avatar
    1 posts
    Member since:
    Jul 2012

    Posted 20 Nov 2013 Link to this post

    My software occasionally triggers the exception below. I'm not sure how to catch it or prevent it. Any ideas? I'm using version 2013.2.812.40.

    Exception Info: System.OverflowException Stack: 
    at System.Decimal..ctor(Double) at Telerik.Charting.LinearAxisModel+<GenerateTicksRegular>d__4.MoveNext() 
    at Telerik.Charting.AxisModel.UpdateTicks() 
    at Telerik.Charting.AxisModel.BuildTicksAndLabels(Telerik.Charting.RadSize) 
    at Telerik.Charting.AxisModel.MeasureCore(Telerik.Charting.RadSize) 
    at Telerik.Charting.AxisModel.Measure(Telerik.Charting.RadSize) 
    at Telerik.Charting.CartesianChartAreaModel+AxisStack.Measure(Telerik.Charting.RadSize) 
    at Telerik.Charting.CartesianChartAreaModel.PrepareAxesStacks(Telerik.Charting.RadSize) 
    at Telerik.Charting.CartesianChartAreaModel.ArrangeAxes(Telerik.Charting.RadRect) 
    at Telerik.Charting.ChartAreaModelWithAxes.ArrangeOverride(Telerik.Charting.RadRect) 
    at Telerik.Charting.ChartNode.Arrange(Telerik.Charting.RadRect, Boolean) 
    at Telerik.Charting.ChartAreaModel.Arrange() 
    at Telerik.Windows.Controls.ChartView.RadChartBase.OnInvalidated() 
    at System.Windows.Threading.ExceptionWrapper.InternalRealCall(System.Delegate, System.Object, Int32) 
    at MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(System.Object, System.Delegate, System.Object, Int32, System.Delegate) 
    at System.Windows.Threading.DispatcherOperation.InvokeImpl() 
    at System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean) 
    at System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean) 
    at System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object) 
    at System.Windows.Threading.DispatcherOperation.Invoke() at System.Windows.Threading.Dispatcher.ProcessQueue() 
    at System.Windows.Threading.Dispatcher.WndProcHook(IntPtr, Int32, IntPtr, IntPtr, Boolean ByRef) 
    at MS.Win32.HwndWrapper.WndProc(IntPtr, Int32, IntPtr, IntPtr, Boolean ByRef) 
    at MS.Win32.HwndSubclass.DispatcherCallbackOperation(System.Object) 
    at System.Windows.Threading.ExceptionWrapper.InternalRealCall(System.Delegate, System.Object, Int32) 
    at MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(System.Object, System.Delegate, System.Object, Int32, System.Delegate) 
    at System.Windows.Threading.Dispatcher.LegacyInvokeImpl(System.Windows.Threading.DispatcherPriority, System.TimeSpan, System.Delegate, System.Object, Int32) 
    at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr, Int32, IntPtr, IntPtr) 
    at MS.Win32.UnsafeNativeMethods.DispatchMessage(System.Windows.Interop.MSG ByRef) 
    at MS.Win32.UnsafeNativeMethods.DispatchMessage(System.Windows.Interop.MSG ByRef) 
    at System.Windows.Threading.Dispatcher.PushFrameImpl(System.Windows.Threading.DispatcherFrame) 
    at System.Windows.Application.RunInternal(System.Windows.Window) at System.Windows.Application.Run() at PacketTester.App.Main() 
  2. Pavel R. Pavlov
    Admin
    Pavel R. Pavlov avatar
    1183 posts

    Posted 25 Nov 2013 Link to this post

    Hi Brannon,

    We understand that you have an issue with our RadChartView control. Please have in mind that in order to assist you we need to reproduce the reported behavior on our side with our latest official release. To do that we need a project reproducing the issue. In order to investigate the any behavior we usually try to reproduce it based on the information that our customers provide.

    However, in this case, the provided stack trace is not enough to reproduce or investigate the issue. This is why we kindly ask you to try to isolate the issue in a sample project and send it over. This is the best way for us to fully understand your custom scenario. If you do so we will be able to provide you with a solution in your custom case.

    Thank you for your cooperation.

    Regards,
    Pavel R. Pavlov
    Telerik
    TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for WPF.
    Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
    Sign up for Free application insights >>
  3. UI for WPF is Visual Studio 2017 Ready
  4. Adam
    Adam avatar
    2 posts
    Member since:
    Jul 2011

    Posted 24 Feb 2014 Link to this post

    Hello,
    I appear to be receiving a similar error. For me it appears to error when we are adding and removing data to the chart. In our application we have multiple datasets that are averaged together to display a single line series on the chart, we have included the ability to add/remove these datasets via checkboxes (checked are included/averaged, unchecked are excluded). It appears that if you uncheck all of them and then recheck one we frequently get a overflow exception and the message is "Value was either too large or too small for a Decimal." I have been able to trap the error and avoid the application from crashing but after doing so the radcartesianchart no longer functions. I will attempt to build a small sample application as time allows. We are currently using version 2013.3.1316.40.

    My StackTrace is below if it helps:
       at System.Decimal..ctor(Double value)
       at System.Decimal.op_Explicit(Double value)
       at Telerik.Charting.LinearAxisModel.<GenerateTicksInverse>d__14.MoveNext() in c:\TB\105\WPF_Scrum\Release_WPF\Sources\Development\Controls\Chart\Engine\Axes\Continuous\LinearAxisModel.cs:line 94
       at Telerik.Charting.AxisModel.UpdateTicks() in c:\TB\105\WPF_Scrum\Release_WPF\Sources\Development\Controls\Chart\Engine\Axes\AxisModel.cs:line 789
       at Telerik.Charting.AxisModel.BuildTicksAndLabels(RadSize availableSize) in c:\TB\105\WPF_Scrum\Release_WPF\Sources\Development\Controls\Chart\Engine\Axes\AxisModel.cs:line 750
       at Telerik.Charting.AxisModel.MeasureCore(RadSize availableSize) in c:\TB\105\WPF_Scrum\Release_WPF\Sources\Development\Controls\Chart\Engine\Axes\AxisModel.cs:line 757
       at Telerik.Charting.AxisModel.Measure(RadSize availableSize) in c:\TB\105\WPF_Scrum\Release_WPF\Sources\Development\Controls\Chart\Engine\Axes\AxisModel.cs:line 665
       at Telerik.Charting.CartesianChartAreaModel.AxisStack.Measure(RadSize availableSize) in c:\TB\105\WPF_Scrum\Release_WPF\Sources\Development\Controls\Chart\Engine\ChartAreas\CartesianChartAreaModel.cs:line 366
       at Telerik.Charting.CartesianChartAreaModel.PrepareAxesStacks(RadSize availableSize) in c:\TB\105\WPF_Scrum\Release_WPF\Sources\Development\Controls\Chart\Engine\ChartAreas\CartesianChartAreaModel.cs:line 333
       at Telerik.Charting.CartesianChartAreaModel.ArrangeAxes(RadRect availableRect) in c:\TB\105\WPF_Scrum\Release_WPF\Sources\Development\Controls\Chart\Engine\ChartAreas\CartesianChartAreaModel.cs:line 114
       at Telerik.Charting.ChartAreaModelWithAxes.ArrangeOverride(RadRect rect) in c:\TB\105\WPF_Scrum\Release_WPF\Sources\Development\Controls\Chart\Engine\ChartAreas\ChartAreaModelWithAxes.cs:line 192
       at Telerik.Charting.ChartNode.Arrange(RadRect rect, Boolean shouldRoundLayout) in c:\TB\105\WPF_Scrum\Release_WPF\Sources\Development\Controls\Chart\Engine\ElementTree\ChartNode.cs:line 214
       at Telerik.Charting.ChartAreaModel.Arrange() in c:\TB\105\WPF_Scrum\Release_WPF\Sources\Development\Controls\Chart\Engine\ChartAreas\ChartAreaModel.cs:line 94
       at Telerik.Windows.Controls.ChartView.RadChartBase.UpdateChartArea() in c:\TB\105\WPF_Scrum\Release_WPF\Sources\Development\Controls\Chart\Visualization\RadChartBase.cs:line 721
       at Telerik.Windows.Controls.ChartView.RadChartBase.CallUpdateUI() in c:\TB\105\WPF_Scrum\Release_WPF\Sources\Development\Controls\Chart\Visualization\RadChartBase.cs:line 1007
       at Telerik.Windows.Controls.ChartView.RadChartBase.OnInvalidated() in c:\TB\105\WPF_Scrum\Release_WPF\Sources\Development\Controls\Chart\Visualization\RadChartBase.cs:line 985
       at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
       at MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(Object source, Delegate method, Object args, Int32 numArgs, Delegate catchHandler)




  5. Pavel R. Pavlov
    Admin
    Pavel R. Pavlov avatar
    1183 posts

    Posted 27 Feb 2014 Link to this post

    Hi Adam,

    We understand that there are issues with the RadChartView control. However, we are not able to investigate the reasons behind the exception without any sample code. We will need to reproduce the exception on our side in order to further investigate the reasons behind.

    Thank you for understanding.

    Regards,
    Pavel R. Pavlov
    Telerik
  6. Adam
    Adam avatar
    2 posts
    Member since:
    Jul 2011

    Posted 27 Feb 2014 Link to this post

    I think I found our problem. We are charting an array of doubles and for some reason there is a way for some of the values to be not a number (NaN). I have added code to detect this and now the error with the RadChartView control has appeard to go away.

    Thanks!
  7. Louis
    Louis avatar
    83 posts
    Member since:
    Aug 2013

    Posted 19 Sep 2014 Link to this post

    Hi,

    I am experiencing this issue as well. Looking at the stack trace, it appears that when calculating the ticks, GridView is converting the values from the double sources to Decimals. This exception occurs when the values are greater than what can be represented by a Decimal type. Here's a simple example that reproduces the problem:

    <telerik:RadCartesianChart>
        <telerik:RadCartesianChart.HorizontalAxis>
            <telerik:CategoricalAxis />
        </telerik:RadCartesianChart.HorizontalAxis>
        <telerik:RadCartesianChart.VerticalAxis>
            <telerik:LinearAxis/>
        </telerik:RadCartesianChart.VerticalAxis>
        <telerik:RadCartesianChart.Series>
            <telerik:BarSeries>
                <telerik:BarSeries.DataPoints>
                    <telerik:CategoricalDataPoint Category="Apples" Value="2e306"/>
                </telerik:BarSeries.DataPoints>
            </telerik:BarSeries>
        </telerik:RadCartesianChart.Series>
    </telerik:RadCartesianChart>

    Decimals only go up to 7.9e28, whereas doubles can go much higher to 1.8e308.

    It really shouldn't need to convert doubles to Decimals to draw ticks...

    Louis
  8. Pavel R. Pavlov
    Admin
    Pavel R. Pavlov avatar
    1183 posts

    Posted 24 Sep 2014 Link to this post

    Hi,

    You are right that such value cannot be visualized in the RadCartesianChart. However, if you know that your data collection will hold such big values the better approach would be to use the metric prefixes in the label of the axis and divide all your data points by the chosen prefix.

    For example if you have the 123456789 value, you can divide it by 1000000 and you can visualize it like this 123.456789. Then in the label of the axis you can use the mega prefix. Please evaluate this approach and let me know if it fits your scenario.

    Regards,
    Pavel R. Pavlov
    Telerik
     
    Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
     
  9. Louis
    Louis avatar
    83 posts
    Member since:
    Aug 2013

    Posted 24 Sep 2014 in reply to Pavel R. Pavlov Link to this post

    Hi Pavel, thank you for the response.

    The Metric prefix reference you gave covers prefixes up to factors of 1e24 (yotta). Since we're talking about factors on the order of magnitude between 1e28 and 1e308, these prefixes don't seem to cover any of the necessary scenarios. Additionally, anyone with a technical background understands scientific notation; I hazard to guess most of those people will be unfamiliar with at least some of the prefixes that do exist (I'd never heard of the Z or Y prefixes on the big end, and several on the small end).

    Additionally, this would be displaying values in units that are not traditional in any particular domain.

    Why is it necessary to convert a double to a decimal to display the label? (Also, allowing the underlying native types to throw an unhandled exception like this should be considered a bug in itself.)

    Louis
  10. Pavel R. Pavlov
    Admin
    Pavel R. Pavlov avatar
    1183 posts

    Posted 25 Sep 2014 Link to this post

    Hello Louis,

    In our observations the biggest percentage of the visualized charts are actually visualizing currency. We decided to work with decimal because of its greater precision. Unfortunately, there is no way for visualizing big numbers with the precision of decimal.

    If you can provide us with sample of your data and a picture of what you need to visualize we might be able to find a way to do that.

    Regards,
    Pavel R. Pavlov
    Telerik
     
    Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
     
Back to Top
UI for WPF is Visual Studio 2017 Ready