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

AxisRange.CalculateMaxValue exception

1 Answer 56 Views
Chart
This is a migrated thread and some comments may be shown as answers.
Alex
Top achievements
Rank 1
Alex asked on 10 Jan 2012, 03:36 PM
Original code:
protected virtual double CalculateMaxValue()
{
    double maxValue = this.ActualMinValue;
 
    while ((decimal)maxValue < (decimal)this.SeriesMaxValue)
        maxValue += this.ActualStep;
 
    return maxValue;
}

If we have maxValue or SeriesMaxValue not in the decimal type range then we have an exception
"Value was either too large or too small for a Decimal.";

Stacktrace
System.OverflowException: Value was either too large or too small for a Decimal.
    в System.Decimal..ctor(Double value)
    в Telerik.Windows.Controls.Charting.AxisRange.CalculateMaxValue()
    в Telerik.Windows.Controls.Charting.AxisRange.UpdateRange()
    в Telerik.Windows.Controls.Charting.AxisRangeY.UpdateRange()
    в Telerik.Windows.Controls.Charting.AxisY.InitializeAxisValuesForAutoRange()
    в Telerik.Windows.Controls.Charting.Axis.BuildAxisData()
    в Telerik.Windows.Controls.Charting.AxisY.BuildAxisData()
    в Telerik.Windows.Controls.Charting.Axis2D`1.UpdateAxisData(Axis axis, Size newSize)
    в Telerik.Windows.Controls.Charting.Axis2D`1.AxisSizeChanged(Object sender, SizeChangedEventArgs e)
    в System.Windows.SizeChangedEventArgs.InvokeEventHandler(Delegate genericHandler, Object genericTarget)
    в System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object target)
    в System.Windows.RoutedEventHandlerInfo.InvokeHandler(Object target, RoutedEventArgs routedEventArgs)
    в System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)
    в System.Windows.UIElement.RaiseEventImpl(DependencyObject sender, RoutedEventArgs args)
    в System.Windows.UIElement.RaiseEvent(RoutedEventArgs e)
    в System.Windows.FrameworkElement.OnRenderSizeChanged(SizeChangedInfo sizeInfo)
    в System.Windows.ContextLayoutManager.fireSizeChangedEvents()
    в System.Windows.ContextLayoutManager.UpdateLayout()
    в System.Windows.ContextLayoutManager.UpdateLayoutCallback(Object arg)
    в System.Windows.Media.MediaContext.InvokeOnRenderCallback.DoWork()
    в System.Windows.Media.MediaContext.FireInvokeOnRenderCallbacks()
    в System.Windows.Media.MediaContext.RenderMessageHandlerCore(Object resizedCompositionTarget)
    в System.Windows.Media.MediaContext.RenderMessageHandler(Object resizedCompositionTarget)
    в System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
    в MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(Object source, Delegate method, Object args, Int32 numArgs, Delegate catchHandler)

WPF 4.0
Telerik 2011.3.1116

1 Answer, 1 is accepted

Sort by
0
Yavor
Telerik team
answered on 13 Jan 2012, 04:39 PM
Hello Alex,

Currently RadChart can process data that is in the range of decimal. This is done to improve precision, as arithmetic operations done in decimal are more precise than those done in double. Our developers investigated this limitation and concluded that more serious changes have to be made to the control internal mechanisms. These changes can reduce the precision when working with small numbers. So, I am afraid these changes have been dropped of our schedule and currently their status is undefined. We will reconsider them again when discussing our plans for the next quarter.

Regards,
Yavor
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

Tags
Chart
Asked by
Alex
Top achievements
Rank 1
Answers by
Yavor
Telerik team
Share this question
or