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

highcharts doesn't require ext/lib by default, cause compatibility issues

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Blocker Blocker
    • 11.4.7.0
    • 10.3.3.0
    • Security Level: Jimmy
    • None

      Steps to Reproduce

      Load a page including a chart

      Current Result

      chart.wpd contains all content from the zk.wpd provided in chart package

      Expected Result

      on-demand client-side exporting libraries are only loaded if the browser request them

      Debug Information

      https://www.highcharts.com/docs/export-module/client-side-export
      https://api.highcharts.com/highcharts/exporting.libURL

      Highcharts includes external libraries for client-side exporting.
      These libraries include CanVG, jsPDF and svg2pdf.js,

      In a standard highcharts (JS + html) deployement, these libraries are loaded on demand if the specific client request them. (canvg is used as a sort of polyfill for IE exporting PNGs for example)

      In ZKChart, these external libraries are front loaded

      In addition, canvg modifies the Array.from function.
      This causes incompatibilities with google maps API v4, so loading it by default is counter-productive.

      Highcharts provide a libURL option which can be used to target the folder containing the JS files for the libraries.
      This should point out to zkau/web/[hash]/js/chart/ext/lib/ which is the location of these files in ZK charts

      Workaround

      There are 2 possible workarounds

      Version replacement in gmap (for gmap compatibility specifically)

      First possible workaround, use a lower API version for gmaps

      <gmaps version="3.25" ...
      

      patch in charts

      2nd possible workaround, zk.wpd replacement for chart
      attached replacement for /src/main/resources/web/js/chart/zk.wpd
      +
      declare libURI in java config

      chart.getExporting().addExtraAttr("libURL",new org.zkoss.json.JavaScriptValue("'"+Executions.getCurrent().getContextPath() + "/zkau/web/_zv11.2.0.0/js/chart/ext/lib/'"));
      

            jumperchen jumperchen
            MDuchemin MDuchemin
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: