Quantcast
Channel: Telerik Forums RSS
Viewing all articles
Browse latest Browse all 84751

Xamarin Pie graph coloring

$
0
0

Hi everyone

I need your help I added a dynamic pie chart ,

but I want to change the color of the segments.

I have followed examples but does not work .

Here my code :

 

        private ObservableCollection<Models.CategoricalData> data1;

        public ObservableCollection<Models.CategoricalData> Data1
        {
            get
            {
                return data1;
            }
            set
            {
                if (data1 == value)
                {
                    return;
                }
                data1 = value;
                OnPropertyChanged();
            }
        }


public override void OnNavigatedTo(NavigationParameters parameters)
        {
            LoadStatusVendingMachineCEDI();
        }

private async void LoadStatusVendingMachineCEDI()
        {
            if (localDbService == null)
            {
                return;
            }

            var AllStatusVendingMachineCEDI = await localDbService.GetStatusVendingMachineCEDIAsync();

            if (AllStatusVendingMachineCEDI != null && AllStatusVendingMachineCEDI.Any())
            {
                StatusVendingMachineCEDI = new ObservableCollection<StatusVendingMachineCEDI>(AllStatusVendingMachineCEDI);

                Data1 = new ObservableCollection<Models.CategoricalData>();

                foreach (var r in StatusVendingMachineCEDI)
                {
                    Data1.Add(new Models.CategoricalData { Category = r.StatusName, Value = r.AmountVendingMachines });
                }

            }
        }

 

 

 

and the XAMAL code:

 

              <telerik:RadPieChart x:Name="chart">
                <telerik:RadPieChart.Series>
                  <telerik:PieSeries ItemsSource="{Binding Data1}" ShowLabels="True">                    
                    <telerik:PieSeries.ValueBinding>
                      <telerik:PropertyNameDataPointBinding PropertyName="Value"/>
                    </telerik:PieSeries.ValueBinding>
                  </telerik:PieSeries>
                </telerik:RadPieChart.Series>
              </telerik:RadPieChart>
            </Grid>

Any Sugestions??

Thanks :)


Viewing all articles
Browse latest Browse all 84751

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>