jQuery UI Widgets › Forums › Chart › How use the click events on line type
This topic contains 6 replies, has 5 voices, and was last updated by Finnigan 13 years, 5 months ago.
-
Author
-
// get the series groups of an existing chart
var groups = $(‘#jqxChart’).jqxChart(‘seriesGroups’);// add a click event handler function to the 1st group
if (groups.length > 0)
{
groups[0].click = function(e)
{
alert(‘event = ‘ + e.event + ‘ index = ‘ + e.elementIndex );
}// update the group
$(‘#jqxChart’).jqxChart({seriesGroups: groups});
}Use this code, nothing happened…..
Hello akun_007,
Unfortunately, the click event is not supported by line type charts.
Best Regards,
DimitarjQWidgets team
http://www.jqwidgets.com/Do you plan to support click events on line charts eventually (_very_ useful!)?
If not, can you suggest some other way to interact with line charts on a mobile device?
Thanks in advance
Alexis
Hello Alexis,
Currently, we have no plans to support click events on line charts.
Best Regards,
DimitarjQWidgets team
http://www.jqwidgets.com/Well, that explains my problem.
Any reason for not being consistent with your API? since you can support the mouseover/out events, it shouldn’t be that hard to add the click too?
I agree that it would be a very useful addition since a bar chart would be too cluttering in my case.
Son la cara
I solved it by doing this:
1- Created two vars to store the selected x and it’s value.
2- Created a function for the mouseover event in “seriesGroups” like this:onChartMouseOver = function (evt) { lastElementIndex = evt.elementIndex; lastElementValue = evt.elementValue; },3- Created a function for the click event of the whole component (which is triggered when the user clicks in any part of the chart, so it requires validation). From there I used the lastElementIndex and lastElementValue previously updated with the last mouseover event.
Hope it helps you.
-
AuthorPosts
You must be logged in to reply to this topic.