Example #1
0
        private double GetAxis(IChartItem item, bool x, double axisSize)
        {
            if (this._axisData == null)
            {
                return(double.NaN);
            }

            object obj = ChartHelper.GetChartItemAxisValue(item, x);

            if (item == null)
            {
                return(double.NaN);
            }

            double value = ChartHelper.ConvertToDouble(obj);

            if (!ChartHelper.DoubleHasValue(value))
            {
                return(double.NaN);
            }

            double result = axisSize * (value - this._axisData.MinValue) / this._axisData.Area;

            if (base.Orientation == AxisLabelOrientation.BottomToTop ||
                base.Orientation == AxisLabelOrientation.RightToLeft)
            {
                result = axisSize - result;
            }

            return(result);
        }
Example #2
0
        private void GetCollectionMinAndMax(object obj, ref double pre, ref double min, ref double max)
        {
            double      tmp, tmpTotalChild;
            IEnumerable enumerable = (IEnumerable)obj;

            tmpTotalChild = double.NaN;
            foreach (var item in enumerable)
            {
                if (item == null || !(item is IChartChildValue))
                {
                    continue;
                }

                tmp = ChartHelper.ConvertToDouble(((IChartChildValue)item).GetValue());
                if (!ChartHelper.DoubleHasValue(tmp))
                {
                    continue;
                }

                if (!ChartHelper.DoubleHasValue(min) || tmp - min < pre)
                {
                    min = tmp;
                }

                if (ChartHelper.DoubleHasValue(tmpTotalChild))
                {
                    tmpTotalChild += tmp;
                }
                else
                {
                    tmpTotalChild = tmp;
                }
            }

            if (!ChartHelper.DoubleHasValue(tmpTotalChild))
            {
                return;
            }

            if (!ChartHelper.DoubleHasValue(max) || tmpTotalChild - max > pre)
            {
                max = tmpTotalChild;
            }
        }
Example #3
0
        private void GetMinAndMax(object obj, ref double pre, ref double min, ref double max)
        {
            var tmp = ChartHelper.ConvertToDouble(obj);

            if (!ChartHelper.DoubleHasValue(tmp))
            {
                return;
            }

            if (!ChartHelper.DoubleHasValue(min) || tmp - min < pre)
            {
                min = tmp;
            }

            if (!ChartHelper.DoubleHasValue(max) || tmp - max > pre)
            {
                max = tmp;
            }
        }