Legend with too many items - Can I add a scrollbar or similar?

I have a chart that could display hundreds of series.  When that happens it appears that the legend just puts as many items as it can on the screen and the rest just disappear off the bottom of the available space.  Is there away of, for example, putting a scrollbar on the legend?

Failing that, is there any other suggested way of handling very large numbers of series in a legend?


4 Replies 1 reply marked as answer

DH Declan Hillier March 20, 2025 09:18 AM UTC


Marked as answer

PP Priyadharshini Periyasamy Syncfusion Team March 20, 2025 10:15 AM UTC

Hi Declan,


I’m glad you found a solution. In addition to your approach, I’d like to share another approach that might be helpful.


Using Legend Items Layout (For a Moderate Number of Items)

If we have a manageable number of series, you can enhance the organization of the legend by customizing the ItemsPanel to use a WrapPanel. This allows the legend items to wrap within the available space, enhancing visibility.


<chart:SfChart x:Name="chartControl">

   <chart:SfChart.Resources>

       <ItemsPanelTemplate x:Key="itemPanelTemplate">                 

            <WrapPanel />

        </ItemsPanelTemplate>

   </chart:SfChart.Resources>

 

   <chart:SfChart.PrimaryAxis>

       <chart:CategoryAxis />

   </chart:SfChart.PrimaryAxis>

 

   <chart:SfChart.SecondaryAxis>

       <chart:NumericalAxis />

   </chart:SfChart.SecondaryAxis>

 

   <chart:SfChart.Legend>

       <chart:ChartLegend ItemsPanel="{StaticResource itemPanelTemplate}" />

   </chart:SfChart.Legend>

</chart:SfChart>

 



For further details, check out our UG. I hope this helps! Please let me know if you have any questions or need further assistance.



Regards,

Priyadharshini P.



DH Declan Hillier March 20, 2025 10:24 AM UTC

Thank you!

The scrollbar is more suitable for my current scenario because the number of series is indeterminate (in theory it could be infinite) but I'll definitely keep this in the bag.  I can see it being really useful when the number of series is large but has a manageable upper limit.



PR Preethi Rajakandham Syncfusion Team March 21, 2025 09:33 AM UTC

Hi Declan Hillier,

Thank you for the update. Please let us know if you require any further assistance on this. We will be happy to assist you.

Regards,

Preethi R


Loader.
Up arrow icon