Uploaded image for project: 'ZK Charts'
  1. ZK Charts
  2. ZKCHARTS-59

ON_CLICK event not working in charts

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Cannot Reproduce
    • Icon: Normal Normal
    • None
    • 2.1.1
    • Firefox on Win10 (but doesn't seem to be specific to this environment)

      I'm attaching an event listener to a chart in a richlet using a piece of code like the following:

      chart.addEventListener(10, Events.ON_CLICK, (Event event) -> {
         //code to execute...
      });
      

      On the client, when the user clicks anywhere on the chart, the event listener is never called. However, the browser console displays the following error:

      TypeError: j.mouseData is not a function

      The root cause of the error can be traced back to Charts.js, and more specifically to the following call when handling 'onClick' events:

      zk.copy(event.mouseData(), {
          xAxis: event.xAxis[0].value,
         yAxis: event.yAxis[0].value
      })
      

      Replacing that call with "null" makes the client-side error go away and subsequently allows the server-side event listener to be called.

            christopherszu christopherszu
            lfrederic lfrederic
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: