Think i found a bug

Oct 26, 2010 at 5:38 PM

Hi there

I'm not sure if this is a bug or i'm missing something

WeightClassPartitioning = new ReadOnlyCollection<int>(new[] { 10, 15, 20, 25, 30 });

When i change the above line to include more than 5 tags i miss tagweight1

Here is what i was trying with the Generation Rules

WeightClassPartitioning = new ReadOnlyCollection<int>(new[] { 2,4,6,8,9,11,12,14,16,18});

TagWeight running for 20 tagitems as follows

int[] weightcount = new int[20] { 40, 32, 26, 26, 24, 24, 20, 20, 18, 18, 16, 16, 16, 16, 15, 12, 12, 12, 11, 11 };

Any help appreciated

Thanks

Oct 27, 2010 at 10:08 AM

Well i think its more of a feature than a bug. I wanted to have my own weight distribution instead of the generated one.

So introduced a flag to TagCloudGenerationRules class OverrideWeightDistribution and put this in place in the method GenerateCssClassTable

 

if (! (OverrideWeightDistribution) )
            {
                // Distribute the css classes according to the tagWeightDistribution parameter
                foreach (var weightOccurrence in weightOccurrences)
                {
                    cssClassTable[weightOccurrence.Weight] = string.Concat(tagCssClassPrefix, tagWeightDistributionIndex);
                    tagsCovered += weightOccurrence.NumberOfTags;
                    if (tagsCovered / (double)distinctTagsCount > (tagWeightDistribution[tagWeightDistributionIndex - 1] + percentageCovered) * 0.01)
                        percentageCovered += tagWeightDistribution[(tagWeightDistributionIndex--) - 1];
                }
            }
            else
            {
                foreach (var weightOccurrence in weightOccurrences)
                {
                    cssClassTable[weightOccurrence.Weight] = string.Concat(tagCssClassPrefix, tagWeightDistributionIndex + 1);
                    tagWeightDistributionIndex--;
                }
            }

 

Forgot to mention. Thanks for the wonderful control looks clean and tidy on our website.