Beispiel #1
0
 public TagCloud(ICircularCloudLayouter layouter, Size minCharSize, Func <int, int> valueToHeight)
     : this(layouter, pair => GetSizeFromValue(pair.Value, pair.Key, valueToHeight, minCharSize))
 {
     this.layouter = layouter;
     if (minCharSize.Width == 0 || minCharSize.Height == 0)
     {
         throw new ArgumentException("Bad min char size: width and height must be non zero");
     }
     if (valueToHeight == null)
     {
         throw new ArgumentNullException(nameof(valueToHeight));
     }
 }
Beispiel #2
0
        private static Size GetSizeFromValue(int value, string tag, Func <int, int> valueToHeight, Size minCharSize)
        {
            var height = valueToHeight(value) + minCharSize.Height;
            var width  = 1.0 * height * tag.Length / minCharSize.Height * minCharSize.Width + minCharSize.Width;

            return(new Size((int)width, height));
        }