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?
Never mind. I found this post which explains it perfectly:-
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.
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.
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
- 4 Replies
- 3 Participants
- Marked answer
-
DH Declan Hillier
- Mar 19, 2025 04:38 PM UTC
- Mar 21, 2025 09:33 AM UTC