Hi,
I created a pie chart and I have two problems..
1. Custom palette
I want to create a custom palette in code-behind
This is my code
private
void
chart1_ItemDataBound(
object
sender, EventArgs e)
{
Telerik.Reporting.Processing.Chart procChart = (Telerik.Reporting.Processing.Chart)sender;
Telerik.Reporting.Chart defChart = (Telerik.Reporting.Chart)procChart.ItemDefinition;
//Find the operations type
Exception exception =
null
;
List<OperationTypeEntity> operationTypes = m_OperationHelper.GetOperationTypes(m_UserId,
ref
exception);
Palette palette =
new
Palette();
palette.Name =
"SSCCustomPalette"
;
foreach
(var serie
in
defChart.Series)
{
//Find the operation type color to use for my custom palette
if
(serie.Name.Equals(
"SeriePerLegenda"
))
{
palette.Items.Clear();
foreach
(var item
in
serie.Items)
{
Color color = ColorTranslator.FromHtml(operationTypes.FirstOrDefault(p => p.Description.Equals(item.Name)).Color);
palette.Items.Add(
new
PaletteItem(color, color));
}
}
}
chart1.CustomPalettes.Add(palette);
chart1.SeriesPalette =
"SSCCustomPalette"
;
}
This code works only after a manual refresh
I can't use need data source event becouse my datasource is already assigned so this events it's not fired.
2. How to print percetage on pie and Description on the legend?
I create a new series and I setted the following:
DataLabelsColum -> Description
DataYColumn -> MyValue
DefaultLabelValue ->#%
Apperance LabelDisplay -> ItemLabels
When I run the report, the legend and the pie labels are the same. I see only the description.
Thanks