ComponentOne FlexChart for WPF
Legend Text Wrap
FlexChart > Working with FlexChart > FlexChart Elements > FlexChart Legend > Legend Text Wrap

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. 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 compares fruit data for three consecutive months. The code shows how to implement legend text wrapping in FlexChart.

<Chart:C1FlexChart x:Name="flexChart" 
                   ItemsSource="{Binding DataContext.Data}"
                   BindingX="Fruit"
                   LegendTextWrapping="Wrap"
                   LegendMaxWidth="80"
                   LegendPosition="Right">
    <Chart:Series SeriesName="系列1 (凡例テキストを折り返す)"
                  Binding="March"/>
    <Chart:Series SeriesName="系列2 (凡例テキストを折り返す)"
                  Binding="April"/>
    <Chart:Series SeriesName="系列3 (凡例テキストを折り返す)"
                  Binding="May"/>
</Chart:C1FlexChart>
flexChart.LegendTextWrapping = C1.Chart.TextWrapping.Wrap
flexChart.LegendPosition = C1.Chart.Position.Right
flexChart.LegendMaxWidth = 80
flexChart.LegendTextWrapping = C1.Chart.TextWrapping.Wrap;
flexChart.LegendPosition = C1.Chart.Position.Right;
flexChart.LegendMaxWidth = 80;
See Also