Is there any example showing how to use methods like 'getItem' and 'getItemIndex' in igDataChart. On this page http://help.infragistics.com/jQuery/2013.1/ui.igDataChart only method signature is shown.
ACTUALLY, I'M TRYING TO FIND WHICH DATA-POINT IS CLICKED, SINCE THERE IS NO EVENT OR METHOD AVAILABLE FOR DATA-POINT CLICK, I TRIED USING SERIES EVENTS.
I tried using the method getItemIndexFromSeriesPixel as below,
//On Series Mouse left Button Up, call logSeriesClick
seriesMouseLeftButtonUp: function (event, args) { logSeriesClick(event, args); },
//Using the mouse position, get the item beneath it.
function logSeriesClick(event, args) {
var xPos = Math.round(args.positionX * 10) / 10; var yPos = Math.round(args.positionY * 10) / 10 logEvent('Series MouseUp (x, y): ' + xPos + ", " + yPos); var item = chart.igDataChart("getItemIndexFromSeriesPixel", "series1", { x: xPos, y: yPos }); logEvent(item);
}
But I'm unable to get any index, the 'item' variable is always having the chart object.
Helloptilwani,
I am just checking have you been able to resolve your issue?
Hello ptilwani ,
I have created a small sample where I have used the same approach for the area series and the mentioned event seems to provide the information about the item like expected. Please notice that in this case the event will fire every time you click over the colored area still the information in the ui,item will point to the label and value to the point from your data source that is closest to the point where you clicked with the mouse.
Please let me know if this helps.
I got this working for other chart types. But I'm getting the values also when clicking at other parts of the series.
Is there a way to narrow down this to 'only data-points'? How do I know if the click happened on data-point or any other part of the series?
Thanks Elena, It worked.
But it is not working for 'area' chart. Is this functionality specific to few chart types?
Hello ptilwani,
You can get the item directly from ui.item element.
seriesMouseLeftButtonDown: function (evt, ui) {
alert("Item label: "+ui.item.Label+" Item.Index "+ui.item.Index+ " Item value: "+ ui.item.Value1);
},
For additional reference please check the attached sample where I show how you can use this event.
Please let me know if you need any additional details on this matter.