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

Overflow exception in LinearAxisModel

10 Answers 159 Views
ChartView
This is a migrated thread and some comments may be shown as answers.
Brannon
Top achievements
Rank 1
Brannon asked on 20 Nov 2013, 10:07 PM
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() 

10 Answers, 1 is accepted

Sort by
0
Pavel R. Pavlov
Telerik team
answered on 25 Nov 2013, 03:54 PM
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 >>
0
Adam
Top achievements
Rank 1
answered on 24 Feb 2014, 07:36 PM
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)




0
Pavel R. Pavlov
Telerik team
answered on 27 Feb 2014, 08:53 AM
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
0
Adam
Top achievements
Rank 1
answered on 27 Feb 2014, 02:22 PM
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!
0
Louis
Top achievements
Rank 1
answered on 19 Sep 2014, 04:56 PM
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
0
Pavel R. Pavlov
Telerik team
answered on 24 Sep 2014, 01:45 PM
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.
 
0
Louis
Top achievements
Rank 1
answered on 24 Sep 2014, 03:46 PM
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
0
Pavel R. Pavlov
Telerik team
answered on 25 Sep 2014, 11:42 AM
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.
 
0
Dragosh
Top achievements
Rank 1
answered on 03 Jul 2017, 10:32 AM

Hi,

Is this issue fixed in some newer version? We use the version 2016.3.1024.45  and we try to display the  YIndex = 4.5555555555555554E+41

The result:

An unhandled exception of type 'System.OverflowException' occurred in Telerik.Windows.Controls.Chart.dll
Additional information: Value was either too large or too small for a Decimal.
Or is there a workaround? Thanks!

0
Martin Ivanov
Telerik team
answered on 05 Jul 2017, 10:03 AM
Hello Dragosh,

In general the chartview is not designed to work with too big or too small values. So, working with such small values could be considered as a not supported scenario. However, there is an item logged in our feedback portal for improving such scenarios.  

Basically, you can avoid this behavior by coercing the small values to bigger values before passing them to the chart.

Regards,
Martin Ivanov
Progress Telerik
Want to extend the target reach of your WPF applications, leveraging iOS, Android, and UWP? Try UI for Xamarin, a suite of polished and feature-rich components for the Xamarin framework, which allow you to write beautiful native mobile apps using a single shared C# codebase.
Tags
ChartView
Asked by
Brannon
Top achievements
Rank 1
Answers by
Pavel R. Pavlov
Telerik team
Adam
Top achievements
Rank 1
Louis
Top achievements
Rank 1
Dragosh
Top achievements
Rank 1
Martin Ivanov
Telerik team
Share this question
or