Mpandroidchart: how to add legend item click listener?

Created on 15 Mar 2018  路  3Comments  路  Source: PhilJay/MPAndroidChart

wontfix

Most helpful comment

I'm also interested by this feature. Hope this will be addressed.

All 3 comments

I'm also interested by this feature. Hope this will be addressed.

That sounds like a nice feature. The user clicks on a legend item and the chart could highlight that specific line, or toggle that data off. Currently the legend is pretty small on the screen, so touch listeners will be difficult to implement without making the legend significantly larger than it already is.

While I would love to add this to the to-do list, I cannot because I know it can be better accomplished by implementing it yourself, without using the built-in legend feature.

Personally, I prefer creating my own legends. You should too, the built-in one is very limiting and only exists as a fast way to show a legend when complexity isn't required. I would recommend doing this in your own code, add a legend yourself in the layout files, and then set up buttons with custom shapes and click listeners that interact with the chart.

Would be a really nice built-in feature, but the complexity it would bring is far out of scope for this project.

Have you implemented this?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

mrZizik picture mrZizik  路  3Comments

SutharRohit picture SutharRohit  路  3Comments

galex picture galex  路  3Comments

blotfi picture blotfi  路  3Comments

thanhcly920 picture thanhcly920  路  3Comments