Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
345
PieChart dynamic series
posted

Hi, 

I have a control with xamPieCHart on it. 

    <StackPanel>
        <ig:XamPieChart x:Name="_pieChart" ItemsSource="{Binding ChartData}" 
                        ValueMemberPath="Value" LabelMemberPath="Key"
                        HorizontalAlignment="Left" Margin="10,10,0,10" 
                        VerticalAlignment="Top" Height="249" Width="268"
                        BorderBrush="Aqua"
                        BorderThickness="2">
        </ig:XamPieChart>
        <TextBlock Text="{Binding Label}"/>
    </StackPanel>

and this is my ViewModel

    public class PieChartViewModel
    {
        

        public PieChartViewModel()
        {
            Label = "First constructor";
            ChartData = new Dictionary<String, double>();

        }
        public PieChartViewModel(IHydraulicsSnapshotAnalysis analysis, MeasurementUnits units)
        {
            Table = new SnapshotPressureTableViewModel(analysis, units);
        }

        public void UpdateVM()
        {
            ChartData.Add("Item 1", 23);
            ChartData.Add("Item 2", 25);
            ChartData.Add("Something", 11);
            ChartData.Add("BlaBla", 19);
            Label = "Test Biniding on this control";
        }
}

Binding works correctly - When I add some entries to the dictionary then I will get the pie chart no problem. 

What the problem is that when I run UpdateVM() from external class the pie chart on the control wont update. Neither will label. What am I doing wrong here?

Thanks

Michal