This question is locked. New answers and comments are not allowed.
I have a chart with three Series Mapping two lines, and one area chart, for the legend I am using auto generated items and setting the label on the series mapping. see the code below
However when I tired to change the legend label from code behind it didn't work
What is the best way yo change the legend label from code behind?
<
telerik:RadChart
HorizontalAlignment
=
"Left"
telerik:StyleManager.Theme
=
"Metro"
Name
=
"SeisLineChart"
VerticalAlignment
=
"Top"
ItemsSource
=
"{Binding}"
Height
=
"500"
Width
=
"700"
Margin
=
"0"
>
<
telerik:RadChart.DefaultView
>
<
telerik:ChartDefaultView
ChartLegendPosition
=
"Bottom"
>
<!--<
telerik:ChartDefaultView.ChartTitle
>
<
telerik:ChartTitle
FontSize
=
"13"
Padding
=
"2"
/>
</
telerik:ChartDefaultView.ChartTitle
>-->
<
telerik:ChartDefaultView.ChartLegend
>
<
telerik:ChartLegend
x:Name
=
"DailyProductionRefLegend"
Header
=
""
UseAutoGeneratedItems
=
"True"
Padding
=
"2,2,5,1"
HorizontalAlignment
=
"Center"
HorizontalContentAlignment
=
"Center"
/>
</
telerik:ChartDefaultView.ChartLegend
>
<
telerik:ChartDefaultView.ChartArea
>
<
telerik:ChartArea
Grid.Row
=
"1"
Grid.RowSpan
=
"2"
x:Name
=
"chartArea"
LegendName
=
"DailyProductionRefLegend"
>
<
telerik:ChartArea.AxisY
>
<
telerik:AxisY
x:Name
=
"yAxis"
Title
=
"Unit"
AutoRange
=
"True"
DefaultLabelFormat
=
"#VAL{###,###}"
/>
</
telerik:ChartArea.AxisY
>
<
telerik:ChartArea.AxisX
>
<
telerik:AxisX
x:Name
=
"xAxis"
Title
=
"Weeks"
AutoRange
=
"True"
LabelStep
=
"4"
IsDateTime
=
"False"
/>
</
telerik:ChartArea.AxisX
>
</
telerik:ChartArea
>
</
telerik:ChartDefaultView.ChartArea
>
</
telerik:ChartDefaultView
>
</
telerik:RadChart.DefaultView
>
<
telerik:RadChart.SeriesMappings
>
<
telerik:SeriesMapping
x:Name
=
"FiveYearsRangeMapping"
LegendLabel
=
"5 Year Ranges"
>
<
telerik:SeriesMapping.SeriesDefinition
>
<
telerik:RangeSeriesDefinition
SeriesName
=
"FiveYearsRange"
ShowItemLabels
=
"False"
ShowItemToolTips
=
"True"
ShowPointMarks
=
"False"
EmptyPointBehavior
=
"Zero"
/>
</
telerik:SeriesMapping.SeriesDefinition
>
<
telerik:SeriesMapping.ItemMappings
>
<
telerik:ItemMapping
DataPointMember
=
"XCategory"
FieldName
=
"Week"
/>
<
telerik:ItemMapping
DataPointMember
=
"High"
FieldName
=
"HighValue"
/>
<
telerik:ItemMapping
DataPointMember
=
"Low"
FieldName
=
"LowValue"
/>
</
telerik:SeriesMapping.ItemMappings
>
</
telerik:SeriesMapping
>
<
telerik:SeriesMapping
x:Name
=
"LastYearMapping"
LegendLabel
=
"Last Year"
>
<
telerik:SeriesMapping.SeriesDefinition
>
<!--<telerik:SplineSeriesDefinition ShowItemLabels="False" ShowItemToolTips="True" ItemToolTipFormat="#DATAITEM.Quantity{###,###,##0} #DATAITEM.UnitCode"/>-->
<
telerik:LineSeriesDefinition
SeriesName
=
"LastYear"
ShowItemLabels
=
"False"
ShowItemToolTips
=
"True"
ShowPointMarks
=
"False"
EmptyPointBehavior
=
"Gap"
/>
</
telerik:SeriesMapping.SeriesDefinition
>
<!--<
telerik:SeriesMapping.GroupingSettings
>
<
telerik:GroupingSettings
ShouldCreateSeriesForLastGroup
=
"True"
>
<
telerik:GroupingSettings.GroupDescriptors
>
<
telerik:ChartGroupDescriptor
Member
=
"Product"
/>
</
telerik:GroupingSettings.GroupDescriptors
>
</
telerik:GroupingSettings
>
</
telerik:SeriesMapping.GroupingSettings
>-->
<
telerik:SeriesMapping.ItemMappings
>
<
telerik:ItemMapping
DataPointMember
=
"XCategory"
FieldName
=
"Week"
/>
<
telerik:ItemMapping
DataPointMember
=
"YValue"
FieldName
=
"LastYearQ"
/>
</
telerik:SeriesMapping.ItemMappings
>
</
telerik:SeriesMapping
>
<
telerik:SeriesMapping
x:Name
=
"CurrentYearMapping"
LegendLabel
=
"Current Year"
>
<
telerik:SeriesMapping.SeriesDefinition
>
<
telerik:LineSeriesDefinition
SeriesName
=
"CurrentYear"
ShowItemLabels
=
"False"
ShowItemToolTips
=
"True"
ShowPointMarks
=
"False"
EmptyPointBehavior
=
"Gap"
/>
</
telerik:SeriesMapping.SeriesDefinition
>
<
telerik:SeriesMapping.ItemMappings
>
<
telerik:ItemMapping
DataPointMember
=
"XCategory"
FieldName
=
"Week"
/>
<
telerik:ItemMapping
DataPointMember
=
"YValue"
FieldName
=
"CurrentYeatQ"
/>
</
telerik:SeriesMapping.ItemMappings
>
</
telerik:SeriesMapping
>
</
telerik:RadChart.SeriesMappings
>
</
telerik:RadChart
>
However when I tired to change the legend label from code behind it didn't work
SeisLineChart.SeriesMappings[0].LegendLabel = "New Legend label";
What is the best way yo change the legend label from code behind?