HumbleSoftware / Flotr2

Graphs and Charts for Canvas in JavaScript.
http://www.humblesoftware.com/flotr2/
MIT License
2.45k stars 528 forks source link

Click vs Hit event on Pies #184

Open bornered opened 11 years ago

bornered commented 11 years ago

Hi,

I need to impliment a click event on pie segments but I am not getting the functionality I would expect.

If I attach to the flotr:click event, the x,y values are those in the graph's plane, not the values of the segments clicked.

If I attache to the flotr:hit event then the values are those of the segments.

Is it possible to get the hit values returned on click?

Thanks,

Ed

cesutherland commented 11 years ago

This was previously implemented by extending the event with hit information in #129.

It's clear to me now that this is confusing. The user needs to resolve object.index like object.series.data[object.index].

Now this will work like:

  graph.observe(container, 'flotr:click', function (position) {
    position.hit; // hit information when there is a hit.
  });