I am trying to add a Pie Chart to a Telerik report for the first time and I am having an issue with that chart being cropped on the right-hand side just after the legend starts. I have included a screen image of the issue.
I have added the pie chart through the design interface and I am populating the data the the OnNeedData event. Below is that code.
I have added the pie chart through the design interface and I am populating the data the the OnNeedData event. Below is that code.
private
void
PieChart_NeedDataSource(
object
sender, System.EventArgs e)
{
//Charts - Columns to Display
string
[] GraphColumnsToExport =
new
string
[2] {
"ShortLegendTitle"
,
"Data"
};
//Charts
DataTable Total = _SharedDataSet.Tables[
"CurrentYearToDate"
].DefaultView.ToTable(
"tempTableName"
,
false
, GraphColumnsToExport);
//Set the Series
Telerik.Reporting.Processing.Chart procChart = (Telerik.Reporting.Processing.Chart)sender;
Telerik.Reporting.Chart defChart = (Telerik.Reporting.Chart)procChart.ItemDefinition;
ChartSeries serie =
new
ChartSeries();
serie.Type = ChartSeriesType.Pie;
serie.Clear();
foreach
(DataRow dr
in
Total.Rows)
{
ChartSeriesItem item =
new
ChartSeriesItem();
item.Label.Visible =
true
;
item.YValue = Convert.ToDouble(dr[
"Data"
]);
item.Name = Convert.ToString(dr[
"ShortLegendTitle"
]);
item.Appearance.Exploded =
false
;
item.Label.TextBlock.Text = item.Name +
" - #%"
;
serie.Items.Add(item);
}
serie.Appearance.LegendDisplayMode = ChartSeriesLegendDisplayMode.ItemLabels;
defChart.Series.Add(serie);
}