This question is locked. New answers and comments are not allowed.
I have a chart with 5 series and have given the user 5 toggle buttons to enable or disable each series. It does not seem to matter if I use hidden or collapsed, but the colors of the legend and the datapoints get out of sync. It appears that the color of the datapoints are fixed from the first series always getting what appears to be cyan. But as I change the visibility of each series defintion, the colors of the datapoints are recalcualted. So if the user clicks the button to turn off the very first series definition, it will disappear, but the second series definition will now take on cyan. That would be fine, except the legend colors don't change.
SeriesMapping sm1 = _rchtHH.SeriesMappings[0];
ISeriesDefinition sd1 = sm1.SeriesDefinition;
sd1.Visibility = (_rrbnHH.IsChecked ==
true
) ? SeriesVisibility.Visible : SeriesVisibility.Collapsed;
ChartLegendItem cli1 = (ChartLegendItem)(_rchtHH.DefaultView.ChartLegend
as
Telerik.Windows.Controls.ItemsControl).Items[0];
cli1.Visibility = (_rrbnHH.IsChecked ==
true
) ? System.Windows.Visibility.Visible : System.Windows.Visibility.Collapsed;
<
telerik:RadChart
x:Name
=
"_rchtHH"
Margin
=
"{StaticResource InnerMargin}"
>
<
telerik:RadChart.DefaultView
>
<
telerik:ChartDefaultView
>
<
telerik:ChartDefaultView.ChartLegend
>
<
telerik:ChartLegend
x:Name
=
"_clSource"
>
</
telerik:ChartLegend
>
</
telerik:ChartDefaultView.ChartLegend
>
<
telerik:ChartDefaultView.ChartArea
>
<
telerik:ChartArea
LegendName
=
"_clSource"
>
<
telerik:ChartArea.AxisX
>
<
telerik:AxisX
DefaultLabelFormat
=
"MMM-yyyy"
LabelRotationAngle
=
"60"
>
</
telerik:AxisX
>
</
telerik:ChartArea.AxisX
>
<
telerik:ChartArea.AxisY
>
<
telerik:AxisY
IsLogarithmic
=
"True"
LogarithmBase
=
"2.2"
>
</
telerik:AxisY
>
</
telerik:ChartArea.AxisY
>
</
telerik:ChartArea
>
</
telerik:ChartDefaultView.ChartArea
>
</
telerik:ChartDefaultView
>
</
telerik:RadChart.DefaultView
>
<
telerik:RadChart.SeriesMappings
>
<
telerik:SeriesMapping
LegendLabel
=
"HH Count"
>
<
telerik:SeriesMapping.SeriesDefinition
>
<
telerik:LineSeriesDefinition
>
<
telerik:LineSeriesDefinition.InteractivitySettings
>
<
telerik:InteractivitySettings
HoverScope
=
"Series"
SelectionScope
=
"Series"
/>
</
telerik:LineSeriesDefinition.InteractivitySettings
>
</
telerik:LineSeriesDefinition
>
</
telerik:SeriesMapping.SeriesDefinition
>
<
telerik:SeriesMapping.ItemMappings
>
<
telerik:ItemMapping
DataPointMember
=
"XValue"
FieldName
=
"Date"
></
telerik:ItemMapping
>
<
telerik:ItemMapping
DataPointMember
=
"YValue"
FieldName
=
"Line1"
></
telerik:ItemMapping
>
</
telerik:SeriesMapping.ItemMappings
>
</
telerik:SeriesMapping
>
<
telerik:SeriesMapping
LegendLabel
=
"Auto Count"
>
<
telerik:SeriesMapping.SeriesDefinition
>
<
telerik:LineSeriesDefinition
>
<
telerik:LineSeriesDefinition.InteractivitySettings
>
<
telerik:InteractivitySettings
HoverScope
=
"Series"
SelectionScope
=
"Series"
/>
</
telerik:LineSeriesDefinition.InteractivitySettings
>
</
telerik:LineSeriesDefinition
>
</
telerik:SeriesMapping.SeriesDefinition
>
<
telerik:SeriesMapping.ItemMappings
>
<
telerik:ItemMapping
DataPointMember
=
"XValue"
FieldName
=
"Date"
></
telerik:ItemMapping
>
<
telerik:ItemMapping
DataPointMember
=
"YValue"
FieldName
=
"Line2"
></
telerik:ItemMapping
>
</
telerik:SeriesMapping.ItemMappings
>
</
telerik:SeriesMapping
>