I am zooming to particular area of the ChartView. Depending on the zoom, some lines may not be visible in the current zoomed in portion of the chart. So, the legend is displaying items that are not currently visible in the chart. I need to display legend only for the lines that are visible in different zoom/pan settings. How to achieve this?
5 Answers, 1 is accepted
Thank you for writing.
You can iterate the ChartElement.LegendElement.StackElement.Children collection and show/hide the respective LegendItemElement according to your custom requirement. You can find below a sample code snippet demonstrating how to hide the chart legend items for series that are not visible in the chart:
If you have any further questions feel free to submit a support ticket in the support ticketing system where threads are handled according to license and time of posting. Thank you for your understanding.
I hope this information helps.
Thank you for writing back.
I have prepared a sample code snippet demonstrating how to hide the legend items for series that are not visible in the zoomed view range:
Note that this is just a sample approach and it may not cover all possible cases. Feel free to modify it in a way which suits your requirement best.
I hope this information helps. If you have any additional questions, please let me know.