Example #1
0
        /// <summary>
        ///   Converts a given amount of pixels to the equivalent size along the x-axis which that amount of pixels represents.
        /// </summary>
        /// <param name="pixels">The amount of pixels for which to know the size along the x-axis.</param>
        /// <param name="intervals">The currently visible interval.</param>
        /// <param name="panelSize">The amount of pixels within which the interval is shown.</param>
        /// <returns></returns>
        protected static TXSize PixelsToSize(double pixels, AxesIntervals <TX, TXSize, TY, TYSize> intervals, Size panelSize)
        {
            double intervalSize = Interval <TX, TXSize> .ConvertSizeToDouble(intervals.IntervalX.Size);

            double size = (pixels / panelSize.Width) * intervalSize;

            return(Interval <TX, TXSize> .ConvertDoubleToSize(size));
        }