Exemple #1
0
        float GetMaxHeight(IEnumerable <GraphPane> paneList, float scaleFactor)
        {
            // Set up some scaled dimensions for calculating sizes and locations
            var defaultCharHeight = FontSpec.GetHeight(scaleFactor);
            var maxCharHeight     = defaultCharHeight;

            // Find the largest charHeight, just in case the curves have individual fonts defined
            foreach (var tmpPane in paneList)
            {
                foreach (var curve in tmpPane.CurveList)
                {
                    if (curve._label._text != string.Empty && curve._label._isVisible)
                    {
                        var tmpHeight = defaultCharHeight;
                        if (curve._label._fontSpec != null)
                        {
                            tmpHeight = curve._label._fontSpec.GetHeight(scaleFactor);
                        }

                        // Account for multiline legend entries
                        tmpHeight *= curve._label._text.Split('\n').Length;

                        if (tmpHeight > maxCharHeight)
                        {
                            maxCharHeight = tmpHeight;
                        }
                    }
                }
            }

            return(maxCharHeight);
        }
Exemple #2
0
        private float GetMaxHeight(PaneList paneList, Graphics g, float scaleFactor)
        {
            // Set up some scaled dimensions for calculating sizes and locations
            float charHeight = FontSpec.GetHeight(scaleFactor);

            // Find the largest charHeight, just in case the curves have individual fonts defined
            foreach (GraphPane tmpPane in paneList)
            {
                foreach (CurveItem curve in tmpPane.CurveList)
                {
                    if (curve._label._text != string.Empty && curve._label._isVisible &&
                        curve._label._fontSpec != null)
                    {
                        float tmpHeight = curve._label._fontSpec.GetHeight(scaleFactor);
                        if (tmpHeight > charHeight)
                        {
                            charHeight = tmpHeight;
                        }
                    }
                }
            }

            return(charHeight);
        }
Exemple #3
0
 /// <summary>
 /// Calculate the size of the <see cref="Gap" /> based on the <see cref="Label.FontSpec" />
 /// height, in pixel units and scaled according to <see paramref="scalefactor" />.
 /// </summary>
 /// <param name="scaleFactor">The scaling factor to be applied</param>
 public float GetScaledGap(float scaleFactor)
 {
     return(FontSpec.GetHeight(scaleFactor) * _gap);
 }