Thread ID: |
Created: |
Updated: |
Platform: |
Replies: |
149019 | Nov 12,2019 06:53 AM UTC | Nov 13,2019 07:00 AM UTC | UWP | 3 |
![]() |
Tags: SfChart |
<Grid.Resources>
<local:DecimalConverter x:Key="decimalConverter"/>
</Grid.Resources>
<syncfusion:SfChart x:Name="Chart" Margin="20" >
<syncfusion:PieSeries x:Name="series1" ItemsSource="{Binding Data}"
Stroke="White" XBindingPath="XValue"
YBindingPath="YValue">
<syncfusion:PieSeries.AdornmentsInfo>
<syncfusion:ChartAdornmentInfo ShowLabel="True" Foreground="White">
<syncfusion:ChartAdornmentInfo.LabelTemplate>
<DataTemplate>
<TextBlock Text="{Binding Converter={StaticResource decimalConverter}}" Foreground="White"/>
</DataTemplate>
</syncfusion:ChartAdornmentInfo.LabelTemplate>
</syncfusion:ChartAdornmentInfo>
</syncfusion:PieSeries.AdornmentsInfo>
</syncfusion:PieSeries>
</syncfusion:SfChart>
|
public class ViewModel
{
public ViewModel()
{
Data = new ObservableCollection<Model>();
Data.Add(new Model(1, 100));
Data.Add(new Model(2, 0.1));
}
public ObservableCollection<Model> Data { get; set; }
}
public class DecimalConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, string language)
{
return Math.Round(System.Convert.ToDouble(value), 0);
}
public object ConvertBack(object value, Type targetType, object parameter, string language)
{
return value;
}
}
|
This post will be permanently deleted. Are you sure you want to continue?
Sorry, An error occured while processing your request. Please try again later.
This page will automatically be redirected to the sign-in page in 10 seconds.