ComponentOne FlexChart for UWP
FlexChart / Working with FlexChart / FlexChart Elements / FlexChart Legend / Legend Text Wrap
In This Topic
    Legend Text Wrap
    In This Topic

    Legend text wrap is a feature to shorten the legend entries by either truncating or wrapping them into multiple lines. This feature gives user the flexibility to effectively utilize chart display area by adjusting the space occupied by legends.

    FlexChart provides text wrapping for the legend text that exceeds the value specified in LegendMaxWidth property, which sets the maximum width of each legend entry. The control enables you to manage legend entries in following two ways:

    In FlexChart, the maximum width set for the legend entries affects both text wrapping and text truncating. To set the maximum width of chart legend entries, set the LegendMaxWidth property. The greater the value set for maximum legend entry width, the less the legend text is wrapped or truncated.

    The following image displays legend texts wrapped into multiple lines.

    The following image displays truncated legend texts.

    The following code uses sample created in Quick Start. The code shows how to implement legend text wrapping in FlexChart.

     

    <Chart:C1FlexChart x:Name="flexChart" 
                       ItemsSource="{Binding DataContext.Data}" 
                       BindingX="Fruit" 
                       LegendTextWrapping="Wrap" 
                       LegendPosition="Right" 
                       LegendMaxWidth="80">
        <Chart:Series SeriesName="Label 1 (The quick brown fox jumps over the lazy dog)" 
                      Binding="March"/>
        <Chart:Series SeriesName="Label 2 (The quick brown fox jumps over the lazy dog)" 
                      Binding="April"/>
        <Chart:Series SeriesName="Label 3 (The quick brown fox jumps over the lazy dog)" 
                      Binding="May"/>
    </Chart:C1FlexChart>
    
    flexChart.LegendTextWrapping = C1.Chart.TextWrapping.Wrap
    flexChart.LegendPosition = C1.Chart.Position.Right
    flexChart.LegendMaxWidth = 80
    
    this.InitializeComponent();
    flexChart.LegendTextWrapping = C1.Chart.TextWrapping.Wrap;
    flexChart.LegendPosition = C1.Chart.Position.Right;
    flexChart.LegendMaxWidth = 80;
    
    See Also

    Understanding FlexChart