This question is locked. New answers and comments are not allowed.
Hi,
I'm using Radchart in winform to databind to a generic list. How can I show both the Percentage and actual value as the label?
Attached is the desired output.
Below is the sample data
Codes
I'm using Radchart in winform to databind to a generic list. How can I show both the Percentage and actual value as the label?
Attached is the desired output.
Below is the sample data
columnname | valuedata |
< 20 days | 112 |
<= 50 days | 532 |
<= 90 days | 40 |
> 90 days | 168 |
Codes
protected void CreateChart()
{
RadChart chartObj = new RadChart();
chartObj.SkinsOverrideStyles = false;
chartObj.ChartTitle.TextBlock.Text = "No of Items";
chartObj.Size = new Size(800, 600);
chartObj.ItemDataBound += new EventHandler<
ChartItemDataBoundEventArgs
>(chartObj_ItemDataBound);
chartObj.DataManager.DataSource = _objBLL.GetData();
chartObj.DataManager.LabelsColumn = "ColumnName";
chartObj.IntelligentLabelsEnabled = true;
chartObj.DataBind();
chartObj.Series[0].Type = ChartSeriesType.Pie;
chartObj.Series[0].Name = "Days";
chartObj.Series[0].Appearance.LegendDisplayMode = ChartSeriesLegendDisplayMode.ItemLabels;
chartObj.Update();
this.Controls.Add(chartObj);
}
protected void chartObj_ItemDataBound(object sender, ChartItemDataBoundEventArgs e)
{
if (e.SeriesItem != null)
{
DataRowView dtView = e.DataItem as DataRowView;
if (dtView != null)
{
e.SeriesItem.Label.TextBlock.Text = string.Format("{0}%", dtView["ChartValue"]);
}
}
}