我几乎默认设置了一切,它适用于较小的数字(9.22337×109),但是当我尝试在系列中添加更大的数字(9.9E + 37)时,控件崩溃了。在进一步检查堆栈迹线时,它似乎是双重的>十进制转换错误?
我想我只是想知道这是否是控件的限制,或者是否需要其他一些配置。只是从看正在发生的事情,我猜它是一个限制,但我想我会在放弃之前问这里,并试图找出一种不同的方式。
System.OverflowException occurred
HResult=-2146233066
Message=Value was either too large or too small for a Decimal.
Source=mscorlib
StackTrace:
at System.Decimal..ctor(Double value)
at System.Decimal.op_Explicit(Double value)
at System.Windows.Forms.DataVisualization.Charting.Axis.RoundedValues(Double inter, Boolean shouldStartFromZero, Boolean autoMax, Boolean autoMin, Double& min, Double& max)
at System.Windows.Forms.DataVisualization.Charting.Axis.EstimateNumberAxis(Double& minimumValue, Double& maximumValue, Boolean shouldStartFromZero, Int32 preferredNumberOfIntervals, Boolean autoMaximum, Boolean autoMinimum)
at System.Windows.Forms.DataVisualization.Charting.Axis.EstimateAxis(Double& minimumValue, Double& maximumValue, Boolean autoMaximum, Boolean autoMinimum)
at System.Windows.Forms.DataVisualization.Charting.Axis.EstimateAxis()
at System.Windows.Forms.DataVisualization.Charting.ChartArea.SetDefaultAxesValues()
at System.Windows.Forms.DataVisualization.Charting.ChartArea.SetData(Boolean initializeAxes, Boolean checkIndexedAligned)
at System.Windows.Forms.DataVisualization.Charting.ChartArea.ReCalcInternal()
at System.Windows.Forms.DataVisualization.Charting.ChartPicture.Paint(Graphics graph, Boolean paintTopLevelElementOnly)
InnerException:
接下来是我从dotPeek中选择的“反汇编的”System.Windows.Forms.DataVisualization.Charting.Axis.RoundedValues函数。
internal double RoundedValues(double inter, bool shouldStartFromZero, bool autoMax, bool autoMin, ref double min, ref double max)
{
if (this.axisType == AxisName.X || this.axisType == AxisName.X2)
{
if (this.margin == 0.0 && !this.roundedXValues)
return inter;
}
else if (this.margin == 0.0)
return inter;
if (autoMin)
min = min < 0.0 || !shouldStartFromZero && !this.ChartArea.stacked ? (double) (Decimal.op_Decrement((Decimal) Math.Ceiling(min / inter)) * (Decimal) inter) : 0.0;
if (autoMax)
max = max > 0.0 || !shouldStartFromZero ? (double) (Decimal.op_Increment((Decimal) Math.Floor(max / inter)) * (Decimal) inter) : 0.0;
return inter;
}