FlexChart | ComponentOne
Sunburst Chart / Legend and Titles
本主题中
    Legend and Titles
    本主题中

    Legend

    The legend displays entries for series with their names and predefined symbols. In Sunburst, you can perform various customizations with the legend, as follows:

    Header and Footer

    Header and Footer are descriptive texts at the top and bottom of the chart that provide information about the overall chart data. You can access Header and Footer of Sunburst chart by using the Header and the Footer property respectively, of the FlexChartBase class. Possible customizations with Header and Footer are as follows:

    The following image displays Sunburst chart with the legend and titles set.

    The following code snippet illustrates how to set respective properties for the legend and titles customization. This code uses the sample created in Quick Start.

    <c1:C1Sunburst x:Name="sunburst" 
                   SelectionMode="Point" 
                   SelectedItemOffset="0.1" 
                   SelectedItemPosition="Top" 
                   Header="Quarterly Sales" 
                   Footer="Company XYZ" 
                   Reversed="True" 
                   Palette="Dark" 
                   Offset="0.1" 
                   ItemsSource="{Binding HierarchicalData}" 
                   Binding="Value" 
                   BindingName="Year,Quarter,Month" 
                   ChildItemsPath="Items" 
                   ToolTipContent="{}{name}&#x000A;{y}" 
                   Height="439" 
                   VerticalAlignment="Bottom" 
                   LegendOrientation="Vertical" 
                   LegendTitle="Year" >
        <c1:C1Sunburst.LegendStyle>
            <c1:ChartStyle FontFamily="Arial" 
                           FontSize="9" 
                           Stroke="DarkCyan"/>
        </c1:C1Sunburst.LegendStyle>
        <c1:C1Sunburst.LegendTitleStyle>
            <c1:ChartStyle FontFamily="Arial" 
                           FontSize="10" 
                           Stroke="Blue"/>
        </c1:C1Sunburst.LegendTitleStyle>
        <c1:C1Sunburst.HeaderStyle>
            <c1:ChartStyle FontFamily="Arial" 
                           FontSize="11" 
                           FontWeight="Bold" 
                           Stroke="Brown"/>
        </c1:C1Sunburst.HeaderStyle>
        <c1:C1Sunburst.FooterStyle>
            <c1:ChartStyle FontFamily="Arial" 
                           FontSize="10" 
                           FontWeight="Bold" 
                           Stroke="Brown"/>
        </c1:C1Sunburst.FooterStyle>
        <c1:C1Sunburst.DataLabel>
            <c1:PieDataLabel Position="Center" 
                             Content="{}{name}" />
        </c1:C1Sunburst.DataLabel>
    </c1:C1Sunburst>
    
    C#
    拷贝代码
    // set the legend orientation 
    sunburst.LegendOrientation = C1.Chart.Orientation.Vertical;
    
    // set the legend position
    sunburst.LegendPosition = C1.Chart.Position.Auto;
    
    // Set the legend font
    sunburst.LegendStyle.FontSize = 9;
    
    // Set the legend font style
    sunburst.LegendStyle.FontStyle = FontStyles.Normal;
    
    // set the legend title 
    sunburst.LegendTitle = "Year";
    
    // set the legend title font
    sunburst.LegendTitleStyle.FontSize = 10;
    
    // set the legend title font style
    sunburst.LegendTitleStyle.FontStyle = FontStyles.Normal;
    
    // set the header
    sunburst.Header = "Quarterly Sales";
    
    // set the header font
    sunburst.HeaderStyle.FontSize = 11;
    
    // set the header font style
    sunburst.HeaderStyle.FontStyle = FontStyles.Normal;
    
    // set the header stroke
    sunburst.HeaderStyle.Stroke = Brushes.Brown;
    
    // set the footer
    sunburst.Footer = "Company XYZ";
    
    // set the footer font size
    sunburst.FooterStyle.FontSize = 10;
    
    // set the footer font style
    sunburst.FooterStyle.FontStyle = FontStyles.Normal;
    
    // set the footer stroke
    sunburst.FooterStyle.Stroke = Brushes.Brown;
    

    VB
    拷贝代码
    ' set the legend orientation 
    sunburst.LegendOrientation = C1.Chart.Orientation.Vertical
    
    ' set the legend position
    sunburst.LegendPosition = C1.Chart.Position.Auto
    
    ' Set the legend font
    sunburst.LegendStyle.FontSize = 9
    
    ' Set the legend font style
    sunburst.LegendStyle.FontStyle = FontStyles.Normal
    
    ' set the legend title 
    sunburst.LegendTitle = "Year"
    
    ' set the legend title font
    sunburst.LegendTitleStyle.FontSize = 10
    
    ' set the legend title font style
    sunburst.LegendTitleStyle.FontStyle = FontStyles.Normal
    
    ' set the header
    sunburst.Header = "Quarterly Sales"
    
    ' set the header font
    sunburst.HeaderStyle.FontSize = 11
    
    ' set the header font style
    sunburst.HeaderStyle.FontStyle = FontStyles.Normal
    
    ' set the header stroke
    sunburst.HeaderStyle.Stroke = Brushes.Brown
    
    ' set the footer
    sunburst.Footer = "Company XYZ"
    
    ' set the footer font size
    sunburst.FooterStyle.FontSize = 10
    
    ' set the footer font style
    sunburst.FooterStyle.FontStyle = FontStyles.Normal
    
    ' set the footer stroke
    sunburst.FooterStyle.Stroke = Brushes.Brown