我有一个telerik饼图,其中标签的值将是6413.857 MWh,75433.695 MWh。如何将千位分隔符(6,413.857 MWh,75,433.695 MWh)添加到图表上显示的这些值中?
我尝试使用dataformat字符串进行格式化,但它根本不会影响该值或者给出一个空白。
<div class="pie">
<telerik:RadHtmlChart runat="server" ID="PChartConsumption" Visible="false" Width="100%" Height="300" Transitions="true" Skin="Silk">
<ChartTitle Text="Consumption in MWh for all the price plans">
<Appearance Align="Center" Position="Top">
</Appearance>
</ChartTitle>
<Legend>
<Appearance Position="Right" Visible="true">
</Appearance>
</Legend>
<PlotArea>
<Series>
<telerik:PieSeries DataFieldY="Consumption" ColorField="Color" ExplodeField="false"
NameField="PricePlanType">
<LabelsAppearance DataFormatString="{0:#,###.000} MWh">
<ClientTemplate>#= kendo.format(\'{0:N3}\', dataItem.Consumption)#</ClientTemplate>
</LabelsAppearance>
<TooltipsAppearance Color="Black" />
</telerik:PieSeries>
</Series>
</PlotArea>
</telerik:RadHtmlChart>
</div>
饼图的数据源
DataTable tbl = new DataTable();
tbl.Columns.Add(new DataColumn("Consumption"));
tbl.Columns.Add(new DataColumn("PricePlanType"));
tbl.Columns.Add(new DataColumn("Color"));
tbl.Columns.Add(new DataColumn("IsExploded"));
string fixedCon, sigCon, sigPlusCon, dodtCon, wspsCon;
if (consumptionFixed > 0)
fixedCon = consumptionFixed.ToString("#.000");
else
fixedCon = "0";
if (consumptionSignature > 0)
sigCon = consumptionSignature.ToString("#.000");
else
sigCon = "0";
if (consumptionSignaturePlus > 0)
sigPlusCon = consumptionSignaturePlus.ToString("#.000");
else
sigPlusCon = "0";
if (consumptionDOT > 0)
dodtCon = consumptionDOT.ToString("#.000");
else
dodtCon = "0";
if (consumptionWSPSubscription > 0)
wspsCon = consumptionWSPSubscription.ToString("#.000");
else
wspsCon = "0";
tbl.Rows.Add(new object[] { fixedCon, PricePlanConstants.GetName(PricePlanEnum.Fixed), "Red", false });
tbl.Rows.Add(new object[] { sigCon, PricePlanConstants.GetName(PricePlanEnum.Signature), "Blue", false });
tbl.Rows.Add(new object[] { sigPlusCon, PricePlanConstants.GetName(PricePlanEnum.SignaturePlus), "Green", false });
tbl.Rows.Add(new object[] { dodtCon, PricePlanConstants.GetName(PricePlanEnum.DOT), "Yellow", false });
tbl.Rows.Add(new object[] { wspsCon, PricePlanConstants.GetName(PricePlanEnum.WSPSubscription), "Pink", true });