highcharts-export-clientside
highcharts-export-clientside copied to clipboard
Support NPM / Browserify
It seems like this module is only able to use global Highcharts object. It would be nice if it could be installed with NPM and require()d like Highcharts itself.
Would submit PR.
If you have time for a PR, sure! Could do for a AMD module too!
Pretty much finished, just waiting for an answer on https://github.com/highcharts/export-csv/issues/72 so the dependency can be expressed correctly in package.json without globals or git references.
Waiting for https://github.com/highcharts/export-csv/pull/79
@A---- Am I understanding correctly that RGBColor and canvg are provided through highcharts/modules/canvas-tools as globals?
Yes :)
That sucks... I don't really want to add a require statement in the code for globals - are there other options? I'm currently in the talks for proper NPM packages for canvg (includes rgbcolor) and export-csv. Is there anything else that is needed from canvas-tools? Is that Highcharts module in there needed?
Well, canvas-tools is a fork of canvg if I remember correctly. And you need it for the SVG to PNG/JPG conversion.
canvg seems Common.js-compatible now: https://github.com/gabelerner/canvg/blob/master/canvg.js
I had some issues with older versions but on more recent attemps, it worked alright.
It also patches (global) Highcharts a custom renderer module: https://github.com/highcharts/highcharts-dist/blob/master/modules/canvas-tools.src.js#L2919
I'm currently working to get a NPM package of canvg. PR for export-csv is submitted and jspdf is available on NPM.
@A---- How are you calling canvg? It must be an XML string, but where does that come from? Do you have a DOM document object initially or a Node object or do you get the string from Highcharts?
The exporting module of Highcharts provides a getSVG() method.
I just found out that Highcharts now supports client side export natively: http://www.highcharts.com/docs/export-module/client-side-export
So this module isnt needed anymore.
Is there any plan to publish on NPM ? Because Highcharts offline export module doesn't support JPEG and PDF yet...
Would love a npm package for this aswell :)