jqplotSeriesPointChange

219 views
Skip to first unread message

genthaler

unread,
Nov 25, 2009, 5:14:18 PM11/25/09
to jqplot-users
Hi,

I'm can trigger a jqplotClick event like so;

function myClickHandler(ev, gridpos, datapos, neighbor, plot) {
alert('hello');
}
$.jqplot.eventListenerHooks.push(['jqplotClick', myClickHandler]);
plot1 = $.jqplot('test',[s1],{...})


but no luck with


function myClickHandler(ev, seriesIndex, pointIndex, pu, p) {
alert('hello');
}
$.jqplot.eventListenerHooks.push(['jqplotSeriesPointChange',
myClickHandler]);
plot1 = $.jqplot('test',[s1],{...})

I've tried firebugging, but I get lost in jQuery/jqplot's internals.

Anyone have a working example?

Thanks,
Günther

genthaler

unread,
Nov 25, 2009, 11:48:53 PM11/25/09
to jqplot-users
I'm trying to catch a jqplotSeriesPointChange event on a draggable
point, so I can send the updated data to a server process.
I'll probably also use it to re-order the data-points and re-render
the chart, since currently the line plot goes all over the place if
you drag a point past a neighbour.
See http://www.jqplot.com/tests/dragableTests.php for the draggable
point demo, or test7.html & test14.html in the unit test suite.

genthaler

unread,
Nov 30, 2009, 9:47:00 PM11/30/09
to jqplot-users
Hmm, I seem to have found the problem.
In jqplot_dragable.js, function handleMove(), line 122

dc._elem.trigger('jqplotSeriesPointChange', [dp.seriesIndex,
dp.pointIndex, [xu,yu], [x,y]]);

the event is being triggered on the drag canvas instead of the event
canvas.
If I change that line to

ev.data.plot.eventCanvas._elem.trigger
('jqplotSeriesPointChange', [dp.seriesIndex, dp.pointIndex, [xu,yu],
[x,y]]);

then the handler I've registered is invoked as expected.
Reply all
Reply to author
Forward
0 new messages