public override void Update(ICoordinateCalculator <double> xCoordCalc, ICoordinateCalculator <double> yCoordCalc)
        {
            base.Update(xCoordCalc, yCoordCalc);

            if (Y1.CompareTo(Y2) > 0)
            {
                MeasureText.VerticalAnchorPoint = VerticalAnchorPoint.Top;
                MeasureText.Margin = new Thickness(0, 5, 0, 0);
            }
            else
            {
                MeasureText.VerticalAnchorPoint = VerticalAnchorPoint.Bottom;
                MeasureText.Margin = new Thickness(0, -5, 0, 0);
            }

            var rangeX = X1.CompareTo(X2) > 0 ? RangeFactory.NewRange(X2, X1) : RangeFactory.NewRange(X1, X2);
            var rangeY = Y1.CompareTo(Y2) > 0 ? RangeFactory.NewRange(Y2, Y1) : RangeFactory.NewRange(Y1, Y2);

            string xText;

            if (xCoordCalc is ICategoryCoordinateCalculator <DateTime> )
            {
                var categoryCalc = (ICategoryCoordinateCalculator <DateTime>)xCoordCalc;
                var indexRange   = (IntegerRange)rangeX;
                var difference   = categoryCalc.TransformIndexToData(indexRange.Max) - categoryCalc.TransformIndexToData(indexRange.Min);
                xText = string.Format("{0:dd} days", difference);
            }
            else
            {
                xText = rangeX.Diff.ToString();
            }


            MeasureText.Text = string.Format("{0:#.##}\n{1}", rangeY.Diff, xText);
        }
Пример #2
0
        public override void Update(ICoordinateCalculator <double> xCoordCalc, ICoordinateCalculator <double> yCoordCalc)
        {
            base.Update(xCoordCalc, yCoordCalc);

            if (Y1.CompareTo(Y2) > 0)
            {
                MeasureText.VerticalAnchorPoint = VerticalAnchorPoint.Top;
                MeasureText.Margin = new Thickness(0, 5, 0, 0);
            }
            else
            {
                MeasureText.VerticalAnchorPoint = VerticalAnchorPoint.Bottom;
                MeasureText.Margin = new Thickness(0, -5, 0, 0);
            }

            var range = Y1.CompareTo(Y2) > 0
                ? RangeFactory.NewRange(Y2, Y1)
                : RangeFactory.NewRange(Y1, Y2);

            MeasureText.Text = string.Format("{0:#.##}", range.Diff);
        }