RadDiagram - set milimeters as unit of measurement

2 posts, 0 answers
  1. Adam
    Adam avatar
    3 posts
    Member since:
    May 2016

    Posted 25 Oct Link to this post

    Hello,

     

    Currently, RadDiagram uses pixels as the unit of measurement. I have been working on a solution, which requires millimeters as the unit of measurement.

    I know I can change RadRuler measurement unit to centimeter (http://www.telerik.com/forums/ruler-that-displays-units-in-inches-mm), but this change only display value on ruler. I need support in the RadDiagram - grid lines in mm, snap to milimeters (not pixels) and page size in mm. How I can add support to milimeters unit?

     

    Thanks you
    Adam

  2. Petar Mladenov
    Admin
    Petar Mladenov avatar
    2891 posts

    Posted 28 Oct Link to this post

    Hello Adam,

    Currently the BackgroundGrid and the DiagramRuler's MeasurementUnit are not directly connected. We understand your requirement and that is why we logged it in our portal as a new feature request.

    What you can do on your side is to set the BackgroundGrid's cell size and all other elements via manual calculations. Here is a part of an internal code that you can use:

    private const double DipsInInch = 96d;
            private const double CmsInInch = 2.54d;
     
            /// <summary>
            /// Converts inches to DIPs (Device Independent Pixel).
            /// </summary>
            /// <param name="inch">An inch value.</param>
            /// <returns>A Dip value.</returns>
            internal static double InchToDip(double inch)
            {
                return inch * DipsInInch;
            }
     
            /// <summary>
            /// Converts DIPs (Device Independent Pixel) to inches.
            /// </summary>
            /// <param name="dip">An inch value.</param>
            /// <returns>A Dip value.</returns>
            internal static double DipToInch(double dip)
            {
                return dip / DipsInInch;
            }
     
            /// <summary>
            /// Converts centimeters to DIPs (Device Independent Pixel).
            /// </summary>
            /// <param name="cm">A centimeter value.</param>
            /// <returns>A Dip value.</returns>
            internal static double CmToDip(double cm)
            {
                return (cm / CmsInInch) * DipsInInch;
            }
     
            /// <summary>
            /// Converts DIPs (Device Independent Pixel) to centimeters.
            /// </summary>
            /// <param name="dip">A Dip value.</param>
            /// <returns>A centimeter value.</returns>
            internal static double DipToCm(double dip)
            {
                return (dip / DipsInInch) * CmsInInch;
            }


    Regards,
    Petar Mladenov
    Telerik by Progress
    Do you need help with upgrading your WPF project? Try the Telerik API Analyzer and share your thoughts!
  3. UI for WPF is Visual Studio 2017 Ready
Back to Top