Hello
I am a newbie in WPF RadChart. Currently I am doing a project where data will be displayed in stacked bar chart. I bound SeriesMappingCollection ViewModel property to SeriesMapping xaml property but it seems works only once (when viewmodel is instantiated)
I am unable to force chart to redraw itself when SeriesMappingCollection is feed with new portion of data.
XAML:
ViewModel:
in getter I am using the mocked data, and this is drawn on chart, but after update of the SeriesMappingCollection next time chart doesn't reflect any changes.
Mocked chart data (btw taken from on of your examples)
Thanks in advance for help.
Regards
I am a newbie in WPF RadChart. Currently I am doing a project where data will be displayed in stacked bar chart. I bound SeriesMappingCollection ViewModel property to SeriesMapping xaml property but it seems works only once (when viewmodel is instantiated)
I am unable to force chart to redraw itself when SeriesMappingCollection is feed with new portion of data.
XAML:
<telerik:RadChart x:Name="DefectChart" Grid.Row="1" SeriesMappings="{Binding DiagramMappings}"></telerik:RadChart>ViewModel:
SeriesMappingCollection _mappings;public SeriesMappingCollection DiagramMappings{ get { if (_mappings == null) { _mappings = new SeriesMappingCollection(); var temp = new SeriesMappingCollection(); var sm = new SeriesMapping(); sm.SeriesDefinition = new StackedBarSeriesDefinition(); sm.ItemMappings.Add(new ItemMapping("Category", DataPointMember.XCategory)); sm.ItemMappings.Add(new ItemMapping("Data", DataPointMember.YValue)); sm.ItemsSource = new List<ChartData>() { new ChartData("C1", 1), new ChartData("C2", 5), new ChartData("C3", 7) }; temp.Add(sm); var sm2 = new SeriesMapping(); sm2.SeriesDefinition = new StackedBarSeriesDefinition(); sm2.ItemMappings.Add(new ItemMapping("Category", DataPointMember.XCategory)); sm2.ItemMappings.Add(new ItemMapping("Data", DataPointMember.YValue)); sm2.ItemsSource = new List<ChartData>() { new ChartData("C1", 10), new ChartData("C2", 7), new ChartData("C3", 18) }; temp.Add(sm2); this._mappings = temp; } return _mappings; } set { _mappings = value; NotifyOfPropertyChange(() => DiagramMappings); }}in getter I am using the mocked data, and this is drawn on chart, but after update of the SeriesMappingCollection next time chart doesn't reflect any changes.
Mocked chart data (btw taken from on of your examples)
public class ChartData { public ChartData(string c, double d) { this.Category = c; this.Data = d; } public string Category { get; set; } public double Data { get; set; } }Thanks in advance for help.
Regards