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

ON_CLICK event not working in charts

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Normal
    • Resolution: Cannot Reproduce
    • Affects Version/s: 2.1.1
    • Fix Version/s: None
    • Labels:
    • Environment:

      Firefox on Win10 (but doesn't seem to be specific to this environment)

      Description

      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.

        Attachments

          Activity

            People

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

              Dates

              Created:
              Updated:
              Resolved: