frappe / charts

Simple, responsive, modern SVG Charts with zero dependencies
https://frappe.io/charts/docs
MIT License
14.95k stars 721 forks source link

Click on last point doesn't work #258

Open edomazi opened 4 years ago

edomazi commented 4 years ago

I have the following chart in which I'd like to be able to click the last point and get the information (value and label data) but I'm not able to. I need to click on it directly and not clicking firstly on another and then on the last one. Am I missing something?

Chart demo: https://codepen.io/edomazi/pen/zYxxjVy

Frappé Charts version: 1.3.0

hammeronthenet commented 4 years ago

I have the same problem with bar chart!

If you see on demo, when isNavigable is true, frappe select automatically last element. For mitigating that, I added a fake label (blank) and a fake value (0) as last label/value.

I know this is not "the solution". In the meantime do you discover something about it? thanks!

scmmishra commented 4 years ago

@edomazi

I'd like to be able to click the last point and get the information (value and label data) but I'm not able to.

Thanks for reporting this. Sure seems like something missing in the library. Just to avoid any confusion, from what I understand you want the event to be triggered automatically for the last item, without have the user to click it themselves?

scmmishra commented 4 years ago

If you see on demo, when isNavigable is true, frappe select automatically last element.

Yes, this behaviour is intentionally added. Any reason you don't want it selected by default?

edomazi commented 4 years ago

@scmmishra

Thanks for answering. No, I'd like, when isNavigable is true, to have no item selected as default (now it automatically selects the last point as hammeronthenet said too). So if a user decides to click on the last point when the chart loads he would be able to and therefore I will do some parsing with the data point he just clicked on.

To be clear, I'm able to get the values from the last point but only if firstly i click on another one then on the last one.

scmmishra commented 4 years ago

We can have a configuration, navigateToLastItem option, with default set to true.

How does this sound?

edomazi commented 4 years ago

That sounds great. So everyone is free to use this how they please

hammeronthenet commented 4 years ago

Yes, for example when I have two charts connected. The first present the main data and the second (onclick) is the detail of the first one. If someone clicks on the last value he is unable to select the data and the only way is to click another "bar" and next click the wanted.

Il ven 26 giu 2020, 11:59 Shivam Mishra notifications@github.com ha scritto:

If you see on demo, when isNavigable is true, frappe select automatically last element.

Yes, this behaviour is intentionally added. Any reason you don't want it selected by default?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/frappe/charts/issues/258#issuecomment-650096936, or unsubscribe https://github.com/notifications/unsubscribe-auth/AH7JGT6COZVD3QBJWA4VJPTRYRWRPANCNFSM4JVFO57A .