PDA

View Full Version : [FIXED] Ext.chart.AbstractChart#getItemForPoint does not ignore hidden series



jep
24 Oct 2012, 1:46 PM
In ST2.1 RC2, Ext.chart.AbstractChart#getItemForPoint simply does this:


getItemForPoint: function (x, y) {
var me = this,
i = 0,
items = me.getSeries(),
l = items.length,
series, item;

for (; i < l; i++) {
series = items[i];
item = series.getItemForPoint(x, y);
if (item) {
return item;
}
}

return null;
},


It does not do any checking to see if the series is actually hidden. This seems like quite an oversight. My preference would be to change it to:



getItemForPoint: function (x, y, includeHidden) {
var me = this,
i = 0,
items = me.getSeries(),
l = items.length,
series, item;

for (; i < l; i++) {
series = items[i];
if (includeHidden || !series.getHidden()) {
item = series.getItemForPoint(x, y);
if (item) {
return item;
}
}
}

return null;
},


That way, if you really wanted to you could include the hidden ones but the default would be to hide them. Honestly, I really don't see the use case where you need to find out which hidden series point is at a certain coordinate.

Similar things apply for getItemsForPoint (the plural version).

jep
24 Oct 2012, 2:23 PM
I was using this with interactions. As I dug into it more, I think there's the same issue upstream in ItemPublisher#relayMethod. It's the code that actually gets called to fire off the interactions. But it's not as obvious to me how a fix should be work with that code.

mitchellsimoens
24 Oct 2012, 6:42 PM
Thanks for the report! I have opened a bug in our bug tracker.