This question is locked. New answers and comments are not allowed.
Hello
in our application, the user can build different kind of charts, that are created using default colors and properties. We want to allow the user to customize the appearance of the chart, specifically, series names and colors.
This is what i'm doing now:
and this is how the chart is declared:
Everything works, except the color of the legend marker, that stays unchanged. I attached a screenshot of the problem, after i changed color and label. As you can see, the color of the legend item is not in sync anymore with the series color.
Is there any way to force the refresh of these items? How should i proceed?
Thanks a lot
in our application, the user can build different kind of charts, that are created using default colors and properties. We want to allow the user to customize the appearance of the chart, specifically, series names and colors.
This is what i'm doing now:
var legendItems = radChart.DefaultView.ChartLegend.ChildrenOfType<ChartLegendItem>();for (int i = 0; i < frm.ViewModel.Items.Count; i++){ var item = frm.ViewModel.Items[i]; // this is the item that describe the new label - color var mapping = mappings[i]; // here i iterate through the series mappings var legend = legendItems[i]; mapping.SeriesDefinition.Appearance.Fill = item.LegendColor; mapping.LegendLabel = item.LegendText; // this seems not to have any effect legend.MarkerFill = item.LegendColor; // no effect legend.Label = item.LegendText;}and this is how the chart is declared:
<telerik:RadChart x:Name="radChart" DataBound="RadChartDataBound"> <telerik:RadChart.DefaultView> <telerik:ChartDefaultView> <telerik:ChartDefaultView.ChartLegend> <telerik:ChartLegend x:Name="chartLegend" UseAutoGeneratedItems="True" Style="{StaticResource MyCustomLegendStyle}" Visibility="{Binding ShowLegend, Converter={StaticResource boolToVisibilityConverter}"> </telerik:ChartLegend> </telerik:ChartDefaultView.ChartLegend>
<telerik:ChartDefaultView.ChartArea> <telerik:ChartArea SelectionChanged="ChartAreaOnSelectionChanged" LegendName="chartLegend" > </telerik:ChartArea> </telerik:ChartDefaultView.ChartArea>
</telerik:ChartDefaultView> </telerik:RadChart.DefaultView> </telerik:RadChart>Everything works, except the color of the legend marker, that stays unchanged. I attached a screenshot of the problem, after i changed color and label. As you can see, the color of the legend item is not in sync anymore with the series color.
Is there any way to force the refresh of these items? How should i proceed?
Thanks a lot