Hi guys,
I am having a RadHTMLChart which it shown in my attached file. I was wondering how do go about displaying number and the percentage base on each stacked column. Currently I am using the code snippet which is shown below:
DataTable source = getData();
// getting my data soruce
ColumnSeries colOnTime =
new
ColumnSeries();
colOnTime.Name =
"WO on Time"
;
colOnTime.LabelsAppearance.Position = Telerik.Web.UI.HtmlChart.BarColumnLabelsPosition.Center;
colOnTime.Stacked =
true
;
colOnTime.Appearance.FillStyle.BackgroundColor = System.Drawing.ColorTranslator.FromHtml(
"#33CC33"
);
colOnTime.LabelsAppearance.ClientTemplate =
"#if (value > 0) {# #=value# #} else {# #} #"
;
ColumnSeries colLate =
new
ColumnSeries();
colLate.Name =
"WO less than "
+ ConfigurationManager.AppSettings[
"KPIThreshold"
] +
" days overdued"
;
colLate.LabelsAppearance.Position = Telerik.Web.UI.HtmlChart.BarColumnLabelsPosition.Center;
colLate.Stacked =
true
;
colLate.LabelsAppearance.ClientTemplate =
"#if (value > 0) {# #=value# #} else {# #} #"
;
ColumnSeries colVeryLate =
new
ColumnSeries();
colVeryLate.Name =
"WO more than "
+ ConfigurationManager.AppSettings[
"KPIThreshold"
] +
" days overdued"
;
colVeryLate.LabelsAppearance.Position = Telerik.Web.UI.HtmlChart.BarColumnLabelsPosition.Center;
colVeryLate.Appearance.FillStyle.BackgroundColor = System.Drawing.ColorTranslator.FromHtml(
"#B80000"
);
colVeryLate.Stacked =
true
;
colVeryLate.LabelsAppearance.ClientTemplate =
"#if (value > 0) {# #=value# #} else {# #} #"
;
ColumnSeries grandTotal =
new
ColumnSeries();
grandTotal.Stacked =
true
;
grandTotal.LabelsAppearance.Position = Telerik.Web.UI.HtmlChart.BarColumnLabelsPosition.OutsideEnd;
grandTotal.Appearance.FillStyle.BackgroundColor = System.Drawing.Color.Transparent;
grandTotal.LabelsAppearance.ClientTemplate =
"#if (value > 0) {# #=value# #} else {# #} #"
;
foreach
(DataRow row
in
source.Rows)
{
int
? wo = Convert.ToInt32(row[
"onTime"
]);
colOnTime.SeriesItems.Add(wo);
wo = Convert.ToInt32(row[
"late"
]);
colLate.SeriesItems.Add(wo);
wo = Convert.ToInt32(row[
"verylate"
]);
colVeryLate.SeriesItems.Add(wo);
}
chrtKPI.PlotArea.Series.Add(colOnTime);
chrtKPI.PlotArea.Series.Add(colLate);
chrtKPI.PlotArea.Series.Add(colVeryLate);
chrtKPI.PlotArea.YAxis.LabelsAppearance.TextStyle.Padding =
"5px"
;
chrtKPI.DataBind();