Xamarin.Forms | ComponentOne
Controls / Sunburst Chart / Features / Legend
In This Topic
    Legend
    In This Topic

    You can specify the position where you want to display the legend using the LegendPosition property of the Sunburst chart. Legend helps in displaying the series of a chart with a predefined symbol and name of the series.

    The position of legend is by default set to "Auto", which means the legend positions itself automatically depending on the real estate available on the device. This allows the Sunburst to efficiently occupy the available space on the device. Users have the option to customize the appearance of the legend and enhance the visual appeal of the Sunburst Chart control.

    The legend automatically wraps when the Position property is set to Top, Bottom, Left or Right, Orientation is set to Horizontal and there is not enough screen real estate.

    The image below shows how the Sunburst Chart appears after applying the properties.

    Flexpie with customized legend

    The following code example demonstrates how to set these properties in C# and XAML. This examples uses the sample created in the Quick Start section.

    In Code

    C#
    Copy Code
    sunburst.LegendPosition = ChartPositionType.Bottom;
    sunburst.LegendOrientation = Orientation.Horizontal;
    sunburst.LegendStyle.Stroke = Color.Aqua;
    sunburst.LegendStyle.StrokeThickness = 2;
    

    In XAML

    XAML
    Copy Code
    <c1:C1Sunburst x:Name="sunburst"  Binding="Value" BindingName="Year,Quarter,Month" LegendPosition="Bottom"
    LegendOrientation="Horizontal">
    <c1:C1Sunburst.LegendStyle>
    <c1:ChartStyle Stroke="Aqua" StrokeThickness="4"></c1:ChartStyle>
    </c1:C1Sunburst.LegendStyle>