Пример #1
0
        internal static void UserValueToInternalValues(Axis xAxis, Axis yAxis, Object userXValue, Double userYValue, out Double internalXValue, out Double internalYValue)
        {
            internalYValue = userYValue;
            internalXValue = Double.NaN;

            if (xAxis != null)
            {
                if (userXValue != null)
                {
                    if (xAxis.IsDateTimeAxis)
                    {
                        try
                        {
                            DateTime dateTime = Convert.ToDateTime(userXValue);
                            internalXValue = DateTimeHelper.DateDiff(dateTime, xAxis.FirstLabelDate, xAxis.MinDateRange, xAxis.MaxDateRange, xAxis.InternalIntervalType, xAxis.XValueType);
                        }
                        catch
                        {
                            throw new ArgumentException("Incorrect DateTime value of XValue.");
                        }
                    }
                    else
                    {
                        internalXValue = Convert.ToDouble(userXValue);
                    }
                }
            }

            if (yAxis != null && yAxis.Logarithmic)
            {
                internalYValue = DataPoint.ConvertYValue2LogarithmicValue(xAxis.Chart as Chart, userYValue, yAxis.AxisType);
            }
            else
            {
                internalYValue = userYValue;
            }
        }