node-export-server icon indicating copy to clipboard operation
node-export-server copied to clipboard

[SVG output] Adding image with URL or base64 url format creates invalid SVG

Open istvanherbak opened this issue 2 years ago • 10 comments

Expected behaviour

The ouptut is a well formatted SVG.

Actual behaviour

Whenever the output type is SVG the result is an invalid SVG result.

The error is :

This page contains the following errors: ... Namespace prefix xlink for href on image is not defined Below is a rendering of the page up to the first error.

Reproduction steps

Take the request_infile.json from the samples\http folder. Change the "type" from png to svg

istvanherbak avatar Nov 27 '23 12:11 istvanherbak

Is any progress on this bug? Right now I'm not able to create svg chart.

DendisPatrik avatar Dec 08 '23 13:12 DendisPatrik

This past 2 weeks we've been focusing on other bugs and features related to the Export Server. This issue is now, however, on the top of my backlog's list once I can reproduce it locally.

The file that was mentioned in the issue (samples/http/request_infile.json) was written for PhantomJS, not for Puppeteer and does not follow the proper export config structure.

Here's a proper export structure for the Puppeteer version of the Export Server: https://github.com/highcharts/node-export-server/tree/stable?tab=readme-ov-file#loading-default-json-config

Please follow this new convention and provide me with a minimal reproducible example (.json file) which would allow me to reproduce this issue locally and then provide a solution as soon as possible.

Thanks in advance!

jszuminski avatar Dec 12 '23 10:12 jszuminski

Hi @jakubSzuminski thanks for info. You can just try it on this example. If I switch type -> "png" it's working correctly. But with type = "svg" it shows me an error what @istvanherbak mentioned above.

example_svg.json

Thanks

DendisPatrik avatar Dec 12 '23 10:12 DendisPatrik

Hello @jakubSzuminski

We have the same issue while trying to generate an SVG file via a POST request with the following payload (JSON) against the node-export-server (CLI) within the docker container.

There's no issue with generating a PNG file with the same payload. The payload works as expected on the old node-export-server with (node-export-server: 2.0.24, node: v10.19.0, npm: 6.14.4, CLI)

payload.json

node --version v18.18.2

npm --version 9.6.6

highcharts-export-server 3.0.3

puppeteer 21.6.0

chromium --version Chromium 119.0.6045.159 Alpine Linux

ENTRYPOINT highcharts-export-server --enableServer 1

We don't use any extra\custom configs, arguments, or environment variables for node-export-server.

image

Thanks

OleksandrNikitin avatar Dec 12 '23 11:12 OleksandrNikitin

Thanks @OleksandrNikitin! That will be really helpful. I will keep you posted on this issue (I will try to take care of it next week).

jszuminski avatar Dec 13 '23 10:12 jszuminski

Hi @jakubSzuminski do you have any update for this issue?

DendisPatrik avatar Feb 05 '24 12:02 DendisPatrik

Apologies for the delay, there's been many other issues that we struggled with here.

Could you please test out the current master branch? We're about to release v4.0.0 and we believe that it might have been solved (at least from what we've checked). I've run the following:

node ./bin/cli.js --infile request_infile.json --outfile chart.svg

and this is my request_infile.json:

{
    "chart": {
      "type": "column"
    },
    "title": {
      "text": "Styling axes"
    },
    "yAxis": [
      {
        "className": "highcharts-color-0",
        "title": {
          "text": "Primary axis"
        }
      },
      {
        "className": "highcharts-color-1",
        "opposite": true,
        "title": {
          "text": "Secondary axis"
        }
      }
    ],
    "series": [
      {
        "data": [1, 3, 2, 4]
      },
      {
        "data": [324, 124, 547, 221],
        "yAxis": 1
      }
    ]
}

and it gets exported as expected. Please keep in mind that the config structure has changed (https://github.com/highcharts/node-export-server?tab=readme-ov-file#default-json-config) and not everything which worked for v2 will work for v3+.

jszuminski avatar Mar 25 '24 15:03 jszuminski

Hi @jszuminski I tried it for my case and it's working correctly. Thanks

DendisPatrik avatar Mar 25 '24 15:03 DendisPatrik

Great, love to hear that!

jszuminski avatar Mar 25 '24 19:03 jszuminski

@jszuminski I found that this issue still occurs again if I'm sending more data to render.

DendisPatrik avatar Apr 24 '24 11:04 DendisPatrik

@DendisPatrik could you please reproduce it and share reproduction steps? It still works here and it seems to me that it has been fixed.

jszuminski avatar Jul 25 '24 11:07 jszuminski

This is a duplicate of this: https://github.com/highcharts/node-export-server/issues/547 and it has been solved here: https://github.com/highcharts/node-export-server/pull/550

jszuminski avatar Jul 31 '24 17:07 jszuminski