Back to Devexpress

PieChartStyle Class

maui-devexpress-dot-maui-dot-charts-4281c9d5.md

latest3.2 KB
Original Source

PieChartStyle Class

Stores the pie chart’s appearance settings.

Namespace : DevExpress.Maui.Charts

Assembly : DevExpress.Maui.Charts.dll

NuGet Package : DevExpress.Maui.Charts

Declaration

csharp
public class PieChartStyle :
    ChartStyleBase

The following members return PieChartStyle objects:

Remarks

Assign a PieChartStyle class instance with the specified appearance settings to the PieChartView.ChartStyle property to customize the pie chart appearance.

Example

This example customizes the appearance and layout of a pie chart.

xaml
<ContentPage>
    <ContentPage.BindingContext>
        <local:ViewModel/>
    </ContentPage.BindingContext>
    <dxc:PieChartView>
        <!--...-->
        <dxc:PieChartView.ChartStyle>
            <dxc:PieChartStyle Palette="{Binding Palette}" 
                               BackgroundColor="#e5e5e5"
                               BorderColor="#747987"
                               BorderThickness="10"
                               SeriesIndent="70"
                               Padding="70,20,0,0"/>
        </dxc:PieChartView.ChartStyle>
    </dxc:PieChartView>
</ContentPage>
csharp
using Microsoft.Maui.Graphics;
// ...
class ViewModel {
    // ...
    readonly Color[] palette;
    public Color[] Palette => palette;

    public ViewModel() {
        // ...
        palette = PaletteLoader.LoadPalette("#25a966", "#f45a4e", "#f8c855", "#f8c855",
                                            "#975ba5", "#496cbe", "#f45a4e");}
}

static class PaletteLoader {
    public static Color[] LoadPalette(params string[] values) {
        Color[] colors = new Color[values.Length];
        for (int i = 0; i < values.Length; i++)
            colors[i] = Color.FromHex(values[i]);
        return colors;
    }
}

Implements

IElementController

INotifyPropertyChanged

Inheritance

System.Object BindableObject Element ChartElementBase ChartElement StyledElement ChartStyleBase PieChartStyle

Extension Methods

Yield<PieChartStyle>()

YieldIfNotNull<PieChartStyle>()

See Also

PieChartStyle Members

DevExpress.Maui.Charts Namespace