It drives me crazy. I am showing a tag cloud based on the number of tags in the database based on the% value. I noticed that when one tag was restored, the font size associated with it was huge (because 100% was received), so some suggested I do this:
var tagSummaryNegative = from af in db.AgileFactors join psf in db.ProjectStoryFactors on af.AgileFactorID equals psf.AgileFactorID join s in db.Stories on psf.StoryID equals s.StoryID join pim in db.ProjectIterationMembers on s.ProjectIterationMemberID equals pim.ProjectIterationMemberID join it in db.Iterations on pim.ProjectIterationID equals it.ProjectIterationID join pro in db.Projects on it.ProjectID equals pro.ProjectID where pro.ProjectID == pro_id && pro.ProjectID == it.ProjectID && it.ProjectIterationID == pim.ProjectIterationID && pim.ProjectIterationMemberID == s.ProjectIterationMemberID && s.StoryCategoryID == 1 && s.StoryID == psf.StoryID && psf.AgileFactorID == af.AgileFactorID group af by af.Name into tagGroup select new { Tag = tagGroup.Key, tagCount = tagGroup.Count() }; int maxTagFrequencyNegative = (from t in tagSummaryNegative select (int?)t.tagCount).Max() ?? 0; var tagCloudNegative = from af in db.AgileFactors join psf in db.ProjectStoryFactors on af.AgileFactorID equals psf.AgileFactorID join s in db.Stories on psf.StoryID equals s.StoryID join pim in db.ProjectIterationMembers on s.ProjectIterationMemberID equals pim.ProjectIterationMemberID join it in db.Iterations on pim.ProjectIterationID equals it.ProjectIterationID join pro in db.Projects on it.ProjectID equals pro.ProjectID where pro.ProjectID == pro_id && pro.ProjectID == it.ProjectID && it.ProjectIterationID == pim.ProjectIterationID && pim.ProjectIterationMemberID == s.ProjectIterationMemberID && s.StoryCategoryID == 1 && s.StoryID == psf.StoryID && psf.AgileFactorID == af.AgileFactorID group af by af.Name into tagGroup select new { Tag = tagGroup.Key, **weight = (tagGroup.Count() == 1) ? (double)1 : ((double)tagGroup.Count() / maxTagFrequencyNegative * 100)** };
Now, when count is 1, the font is small, but when 2, it becomes huge again. Tags with fewer samples become smaller than tags with the largest number, but I need it to start small and keep growing. Please help!
public string GetTagSize(double weight) { if (weight >= 99) return "36pt"; else if (weight >= 80) return "29pt"; else if (weight >= 64) return "23pt"; else if (weight >= 48) return "18pt"; else if (weight >= 32) return "14pt"; else if (weight >= 10) return "11pt"; else return "8pt"; }
user618616
source share