Forum How do I...?

Are there any charting libraries that work?

ray
We are trying to see if there are any charting libraries that can work with PrinceXML 11, but couldn't find. Any suggestions for work around? Some of the suggestions are to use PhantomJS, but it won't fit into our application. We are not looking for complicated charts, just some basic bar charts, pie charts etc.
hallvord
Hi Ray,
Highcharts is an example of a library that works pretty well in Prince as far as I've tested it - it does however need some workarounds to be compatible. Have a look at compat.js here:

https://github.com/yeslogic/prince-scripts/tree/master/compatibility/Highcharts

The comments should explain how to use it and what it does, and I'm happy to answer any questions. I'm investigating the compatibility of several other charting libraries too, and if you have any particular favourites I'd like more names on my list. The way Prince runs JS (pre-layout, no reflow) means several of them won't work without major and brittle hacks, but some are easier than others.. Hope you get good results from Highcharts!

Announcement: repos for tests/utils

larjo
We have a couple of different charts in our reports but we generate them beforehand in svg and inline them in the html before rendering the pdf. So there's no need for any js-libraries in prince.

Our graphs are not very complicated so I generate them myself from json with our html-templating engine (mustache). It is actually not too complicated but I am sure there are libraries out there.

adampal
Hey hallvord,
Did your research into other charting libraries turn up anything? I'm looking at options at the moment.
I'm currently using canvasjs for my web charts but it seems like that's still not compatible with Prince so I'm looking into what else I could use.
hallvord
Hi Adam, sorry to be slow responding. I'm looking at the space now and then, sometimes feeding Mike & colleagues some bugs to work on to improve compatibility. Since you mention CanvasJS I plan to experiment a bit with demos from https://canvasjs.com/javascript-charts/ and see if I can get any of them to render in Prince :)

Announcement: repos for tests/utils

adampal
Thanks Halvord.
So just to be clear, right now there are no javascript charting libraries that work with Prince?
hallvord
I got Hicharts working with the compat shim library I wrote a while ago, as described above, but I haven't tested recently if it still works.

Announcement: repos for tests/utils

adampal
Ok thanks. I tried the shim but couldn't get it working with the current version.