Intevation / intelmq-fody

Web interface to IntelMQ
9 stars 3 forks source link

Export charts for printing #37

Closed bernhardreiter closed 7 years ago

bernhardreiter commented 7 years ago

When displaying charts, they should be exportable for printing.

Possible formats: PDF, SVG.

SVG may have advantages if your office suit can do it. Libreoffice has SVG import. Microsoft Office seems to have one since version 2016.

For the web using an HTML5 canvas with SVG seems to be the best technical way and should be done first. A possible extension is to transform this svg into pdf. Maybe with something like https://github.com/ahwolf/jsPDF/blob/master/jspdf.plugin.svgToPdf.js (also see server side solutions like https://d3export.housegordon.org/).

bernhardreiter commented 7 years ago

Export of client side generated files can happen via data URIs, see Resources tab on http://caniuse.com/#feat=datauri

bernhardreiter commented 7 years ago

The http://www.chartjs.org/docs/#notes-charting-library-comparison show that chart.js uses canvas, so with planned export we are probably better off with SVG generation, found an example for vue integration of d3: https://github.com/johnnynotsolucky/samples/tree/master/vuejs-d3

dmth commented 7 years ago

Integration of SVG in Microsoft Word 2016 seems to be available.

https://support.office.com/en-us/article/Insert-SVG-images-in-Microsoft-Office-69f29d39-194a-4072-8c35-dbe5e7ea528c

bernhardreiter commented 7 years ago

Clarifications within our project shows: SVG is good enough, if it can be used in libreoffice. Which means we need to have the style within the attributes of the SVG tags (see #38)

bernhardreiter commented 7 years ago

8a31f0c5a88d1f8ca8e5108cd9cffcadfa01e021 can export an SVG that opens in libreoffice.

bernhardreiter commented 7 years ago

Except for the translation to the right, the implemented export works for libreoffice (tested with 5.2.5.1) and inkscape (tested with 0.48.5) with 1b647f165d39f009eb750cc0e383ca93d3438391

bernhardreiter commented 7 years ago

Done except #41