Vaadin Charts and Highcharts exporter issue

We use Vaadin Charts w flow, Vaadin 23, and have set up a highcharts export server so that we don’t send our customer’s data in the clear around the open internet to generate image versions of the charts. This has worked pretty well with a few limitations. However, the highcharts export server depends on a now quite stale version of node.js and the installer that I’ve been using has stopped working. Why is this a Vaadin question?
Well, after updating, I’ve discovered that the highcharts js payloads that vaadin charts sends to be rendered aren’t understood by the newer highcharts service and I’m trying to figure out a way around it.
Basically, what we do is:

  1. ChartSerialization.toJSON(myChart.getConfiguration()) to get the js,
  2. then wrap it with some highcharts directives
  3. send it off to a highcharts export server and dump the returned binary to a download.

The problem is that the js contains various label formatters as “_fn_formatter” elements that contain js as string values. These seem to break the export server.

So I’m trying to figure out if there’s something I can transform these to. I can rip those element pairs out of the payload to get it to render, but of course, those labels disappear. This doesn’t matter for tooltips, but does in a few other cases.

Any suggestions would be appreciated.

Did you try the official way to charts with vaadin-charts-flow-svg-generator? It handles the fn wrapped calls and creates a SVG (the better image format I would say)

it’s definitely a better way, but my users expect PNG and PDF as well as SVG. I suppose I could use Batik to rasterize the SVG… this is turning into a bigger project than a bugfix though.

You said you were open for any suggestions :grimacing:

okay - so I spent some time implementing it anyway. The good news is that it works, but with some caveats: 1) it doesn’t seem to coordinate with the default CSS setup. In particular, plot options really really requires explicit setting of borderWidth(0) to avoid unusuable highcharts behavior on anything approaching dense datapoints. 2) batik is a pain to set up due to various dependency declaration bugs.

that said, I’ve got it working so I’m happily going to dispose of the highcharts export server! Thanks!