highcharts-export-clientside icon indicating copy to clipboard operation
highcharts-export-clientside copied to clipboard

Support NPM / Browserify

Open felixfbecker opened this issue 9 years ago • 13 comments

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.

felixfbecker avatar Jan 16 '16 23:01 felixfbecker

If you have time for a PR, sure! Could do for a AMD module too!

A---- avatar Jan 19 '16 16:01 A----

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.

felixfbecker avatar Jan 19 '16 18:01 felixfbecker

Waiting for https://github.com/highcharts/export-csv/pull/79

felixfbecker avatar Jan 20 '16 11:01 felixfbecker

@A---- Am I understanding correctly that RGBColor and canvg are provided through highcharts/modules/canvas-tools as globals?

felixfbecker avatar Jan 20 '16 13:01 felixfbecker

Yes :)

A---- avatar Jan 20 '16 16:01 A----

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?

felixfbecker avatar Jan 20 '16 16:01 felixfbecker

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.

A---- avatar Jan 20 '16 17:01 A----

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.

felixfbecker avatar Jan 20 '16 17:01 felixfbecker

@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?

felixfbecker avatar Jan 20 '16 17:01 felixfbecker

The exporting module of Highcharts provides a getSVG() method.

A---- avatar Jan 20 '16 18:01 A----

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.

felixfbecker avatar Jan 21 '16 10:01 felixfbecker

Is there any plan to publish on NPM ? Because Highcharts offline export module doesn't support JPEG and PDF yet...

ulrik59 avatar Mar 29 '16 12:03 ulrik59

Would love a npm package for this aswell :)

deathran avatar May 03 '16 14:05 deathran