Ejemplo n.º 1
0
        /// <summary>
        /// Create function that when given a range will return the
        /// amount in pixels by which the value margin range
        /// overlaps.  Positive numbers represent values outside the
        /// range.
        /// </summary>
        /// <param name="valueMargins">The list of value margins, coordinates, and overlaps.</param>
        /// <param name="comparableRange">The new range to use to calculate coordinates.</param>
        internal void UpdateValueMargins(IList <ValueMarginCoordinateAndOverlap> valueMargins, Range <IComparable> comparableRange)
        {
            double actualLength      = this.ActualLength;
            int    valueMarginsCount = valueMargins.Count;

            for (int count = 0; count < valueMarginsCount; count++)
            {
                ValueMarginCoordinateAndOverlap item = valueMargins[count];
                item.Coordinate   = GetPlotAreaCoordinate(item.ValueMargin.Value, comparableRange, actualLength).Value.Value;
                item.LeftOverlap  = -(item.Coordinate - item.ValueMargin.LowMargin);
                item.RightOverlap = (item.Coordinate + item.ValueMargin.HighMargin) - actualLength;
            }
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Returns the value margin, coordinate, and overlap triples that have the largest left and right overlap.
 /// </summary>
 /// <param name="valueMargins">The list of value margin, coordinate, and 
 /// overlap triples.</param>
 /// <param name="maxLeftOverlapValueMargin">The value margin, 
 /// coordinate, and overlap triple that has the largest left overlap.
 /// </param>
 /// <param name="maxRightOverlapValueMargin">The value margin, 
 /// coordinate, and overlap triple that has the largest right overlap.
 /// </param>
 internal static void GetMaxLeftAndRightOverlap(IList<ValueMarginCoordinateAndOverlap> valueMargins, out ValueMarginCoordinateAndOverlap maxLeftOverlapValueMargin, out ValueMarginCoordinateAndOverlap maxRightOverlapValueMargin)
 {
     maxLeftOverlapValueMargin = null;
     maxRightOverlapValueMargin = null;
     double maxLeftOverlap = double.MinValue;
     double maxRightOverlap = double.MinValue;
     int valueMarginsCount = valueMargins.Count;
     for (int cnt = 0; cnt < valueMarginsCount; cnt++)
     {
         ValueMarginCoordinateAndOverlap valueMargin = valueMargins[cnt];
         double leftOverlap = valueMargin.LeftOverlap;
         if (leftOverlap > maxLeftOverlap)
         {
             maxLeftOverlap = leftOverlap;
             maxLeftOverlapValueMargin = valueMargin;
         }
         double rightOverlap = valueMargin.RightOverlap;
         if (rightOverlap > maxRightOverlap)
         {
             maxRightOverlap = rightOverlap;
             maxRightOverlapValueMargin = valueMargin;
         }
     }
 }
        /// <summary>
        /// Returns the value margin, coordinate, and overlap triples that have the largest left and right overlap.
        /// </summary>
        /// <param name="valueMargins">The list of value margin, coordinate, and
        /// overlap triples.</param>
        /// <param name="maxLeftOverlapValueMargin">The value margin,
        /// coordinate, and overlap triple that has the largest left overlap.
        /// </param>
        /// <param name="maxRightOverlapValueMargin">The value margin,
        /// coordinate, and overlap triple that has the largest right overlap.
        /// </param>
        internal static void GetMaxLeftAndRightOverlap(IList <ValueMarginCoordinateAndOverlap> valueMargins, out ValueMarginCoordinateAndOverlap maxLeftOverlapValueMargin, out ValueMarginCoordinateAndOverlap maxRightOverlapValueMargin)
        {
            maxLeftOverlapValueMargin  = new ValueMarginCoordinateAndOverlap();
            maxRightOverlapValueMargin = new ValueMarginCoordinateAndOverlap();
            double maxLeftOverlap    = double.MinValue;
            double maxRightOverlap   = double.MinValue;
            int    valueMarginsCount = valueMargins.Count;

            for (int cnt = 0; cnt < valueMarginsCount; cnt++)
            {
                ValueMarginCoordinateAndOverlap valueMargin = valueMargins[cnt];
                double leftOverlap = valueMargin.LeftOverlap;
                if (leftOverlap > maxLeftOverlap)
                {
                    maxLeftOverlap            = leftOverlap;
                    maxLeftOverlapValueMargin = valueMargin;
                }
                double rightOverlap = valueMargin.RightOverlap;
                if (rightOverlap > maxRightOverlap)
                {
                    maxRightOverlap            = rightOverlap;
                    maxRightOverlapValueMargin = valueMargin;
                }
            }
        }