youcef92 / flotr

Automatically exported from code.google.com/p/flotr
0 stars 0 forks source link

trackFormatter callback doesn't know which data series has been hit #91

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
Hi!

When using track formatter callback you get the index var, which is useful
as it tells you which piece of data has been hit with a mouse. But you do
not get the info which _series_ of data has been hit.

I have solved this for me and would love to see it land in trunk. All three
changes are in function hit().

1) 
i, n = {
    dist:Number.MAX_VALUE,
    ...
    index:null,
    dataIndex:null // add this
};

2)  if(((!s.bars.show) && xdiff < xsens && ydiff < ysens) || 
    ...
    {
        ...
        n.series = s;
        n.index = j;
        n.dataIndex=i; // add this
    }

3) 
mt.innerHTML = n.mouse.trackFormatter({x: n.x.toFixed(decimals), y:
n.y.toFixed(decimals), series: n.series, index: n.index, dataIndex:
n.dataIndex}); // add dataIndex

This way callback function can change output based on series data that has
been hit.

Please let me know if there is a better way of sending patches. 

Enjoy!

Original issue reported on code.google.com by anz...@gmail.com on 17 Sep 2009 at 10:30

GoogleCodeExporter commented 8 years ago
Is this patch accepted? Please comment so I know if I should be sending further
patches or not... :)

Original comment by anz...@gmail.com on 29 Sep 2009 at 11:16

GoogleCodeExporter commented 8 years ago
Anyone? I would like to upgrade to a newer version of Flotr. Do I have to merge 
it
all the time? Please comment. Thanks!

Original comment by anz...@gmail.com on 21 Dec 2009 at 9:07