這讓我瘋狂。我正在基於%值基於數據庫中標記的計數顯示標記雲。我注意到,當一個標籤被retrived,相關的字體大小是巨大的(因爲100%的檢索),所以有些人建議我這樣做:標籤雲字體大小計算邏輯
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)**
};
現在,當計數爲1,字體很小,但是當2,它又回到了巨大的水平。計數較小的標籤相對於具有最大計數的標籤變小 - 但我需要它從小尺寸開始並保持增長。請幫忙!
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";
}
'maxTagFrequencyNegative'的值是什麼?爲什麼你會用一個負值來分割? – Justin 2011-02-25 18:16:11
這不是一個負值 - 我使用的是LINQ ... maxTagFrequencyNegative只是帶有相關負面故事的標籤的別名... – user618616 2011-02-25 18:18:12
+1對於推薦對人們很好,它只會鼓勵一個良好的社區,如果您獎勵回答你喜歡/用過 – 2011-02-25 18:23:34