1. 程式人生 > >RDLC-Chart餅圖上顯示百分比

RDLC-Chart餅圖上顯示百分比

RDLC在餅圖上顯示百分比不像水晶報表那樣便捷,需要自己定義相應的公式。但這種方式也使得RDLC更為靈活。

在RDLC的餅圖上顯赫百分比可參考如下公式:

=FormatPercent(Count(Fields!ProductId.Value)/Count(Fields!ProductId.Value, "ReportDataSet_OrderView"),2)

FormatPercent(XX,2)表示格式化為兩位小數的百分比。

關鍵為Count(Fields!ProductId.Value)及Count(Fields!ProductId.Value, "ReportDataSet_OrderView")

Count(Fields!ProductId.Value)的域為遍歷的當前域,從而可以取到當前分組的Count值;

Count(Fields!ProductId.Value, "ReportDataSet_OrderView")表示整個資料集,從而可以取到總數值。