Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <pre><code>$.jqplot.eventListenerHooks.push(['jqplotClick', myClickHandler]); </code></pre> <p>This call will attach onClick handler to the whole event canvas. (This event canvas is with the size of the plot and should be ABOVE all other canvases to work - meaning that you might need to manually modify it's z-index to make things work). What I think is happening in your case is this:</p> <ol> <li><p>You are attaching "myClickHandler" method to the event canvas. It will be fired every time event canvas is clicked, no matter where - over the series or over the background of the plot.</p></li> <li><p>In the case with barchart renderer this event canvas is below the series canvas (either it is created before series canvas, or it has lower z-index). Solution would be to manually increase the z-index of the event canvas AFTER chart was created. After this it will be on top and click events will be handled correctly.</p></li> <li><p>Remember, this click event will fired on every click over the plot, no matter where. Solution would be to filter the execution of the "myClickHandler" method like this:</p></li> </ol> <p>Code:</p> <pre><code>function myClickHandler(ev, gridpos, datapos, neighbor, plot) { if (isClickEventOverTheSeries(gridpos)) { alert('you have triggered click action'); } } </code></pre> <p>In this example <strong><em>gridpos</em></strong> is array which contains 2 points - x and y coordinates of the click event. "<strong>isClickEventOverTheSeries</strong>" method is function which checks if under this coordinates there is series drawn. I'm not sure how to achieve this with BarChart renderer - I never used it, but with the line render there is a method which checks it...</p> <p>Hope this helps</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload