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.
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.
Thanks Elena, It worked.
But it is not working for 'area' chart. Is this functionality specific to few chart types?
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?
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.
Hi,
I realize this thread is now more than 5 years old as I'm writing this, but I have something that comes close to the original problem. I'm using seriesMouseLeftButtonDown(), which works *great* - I've managed to adapt the sample so it works with a stackedBar with 17.2.
Here's my issue: While this works fine for clicking on the graph portion itself, I'd like to know when a corresponding *label* (on the left of the graph) has been clicked. seriesMouseLeftButtonDown() only works on the graph, and I see no corresponding "labelMouseLeftButtonDown()".
Any idea how I could accomplish this?
Thanks for confirming my suspicion. I'll see about posting this as a feature request.
Dear Daniel Desormeaux,
Thank you for providing us with more details regarding your question!
After having investigated this case more thoroughly, I would like to inform you that the text which is shown alongside the chart is part of the canvas and is not interactable by design.
Following up on that, I would like to recommend posting a feature request for this unsupported functionality.
Submitting your request would allow you to communicate directly with our product management team and it would also allow you to track its progress as well as see how many votes and comments it has received from other developers in our community. You may also be contacted by someone from our product team with additional questions about your request.
A good practice, when submitting a feature request, is to add screenshots and more detailed explanation. You could also link this thread for even more details. These will make your case stronger and more likely to be followed through.
Please note that for a suggestion to be successful, it needs to receive votes from other community members.
Please feel free to contact us at any time should you require any additional assistance.
Thanks for the quick response. Unfortunately I probably haven't explained my issue as clearly as I should. Since a picture is worth 1000 words, I've attached a screenshot.
Currently, I can click on a section of the bargraph (any purple/green/red/blue segment) and determine exactly what was clicked--both the integer value and the name of the "parent" (what I mistakenly called the "label" in my previous question). For example, if I click on the highlighted section in my screenshot (the green segment for "Microsoft.Windows.InternetInformationServices.2008") I can get both the numeric value and the text of the "row" it's part of. I want that text of the row when I click on it directly and not the graph.
However, there's no click event available to me if I click on the text portion itself ("Microsoft.Windows.InternetInformationServices.2008"). Clearly, I don't want to introduce a separate, redundant "label" for each item.
Any thought?
We would like to inform you that we do not have a functionality such as "labelMouseLeftButtonDown()" events/handlers supported out of the box, however you may try implementing it yourself, depending on your use-case.
I have attached a sample, which should provide you with a better understanding of how you may do that.
Please let us know if you need further assistance.
sample.rar