Description: The legend items are used to display the series label values. When more number of series are added to the chart, some of the legend items are hidden from the view. The chart allows you to place the chart legend inside the scrollbar to view all the legend items. This articles describes how to add multiple legend items inside the scrollbar. Solution: To add multiple legend items inside any container such as scroll viewer, define the control template for the legends as illustrated in the following code example. XAML <!—Adding ScrollViewer for Legend items--> <chart:SfChart x:Name="sfchart" Margin="10" > <chart:SfChart.Legend> <chart:ChartLegend DockPosition="Top"> <chart:ChartLegend.Template> <ControlTemplate> <ScrollViewer Margin="30" VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Auto"> <ItemsPresenter> </ItemsPresenter> </ScrollViewer> </ControlTemplate> </chart:ChartLegend.Template> </chart:ChartLegend> </chart:SfChart.Legend> </chart:SfChart> The following screenshot illustrates the output. OutputFigure 1: Chart legends in ScrollViewer. |
This page will automatically be redirected to the sign-in page in 10 seconds.