vega / vl-convert

Utilities for converting Vega-Lite specs from the command line and Python
BSD 3-Clause "New" or "Revised" License
96 stars 12 forks source link

SVG has an invalid size error: how to solve it #45

Closed aborruso closed 1 year ago

aborruso commented 1 year ago

Hi, I have this vega-lite definition (here in the editor).

When I run vl-convert vg2png -i chart.json -o o.png I have

Error: Vega-Lite to Vega conversion failed: Failed to parse SVG string: SVG has an invalid size

I cannot set a size, because I have several kinds of input files, and sometimes I will have two boxes, sometimes five boxes.

Is there a way to have a png starting from this kind of input?

Thank you

jonmmease commented 1 year ago

Thanks for the report @aborruso. Does vl2svg work? If so, could you include this resulting SVG file?

Some notes: The error is coming from usvg at:

https://github.com/vega/vl-convert/blob/c694065fe4e222049dbc5d56a1045e9026870bc3/vl-convert-rs/src/converter.rs#L688-L693

Marking as a bug since this works in the Vega editor

jonmmease commented 1 year ago

Oh! this is a Vega-Lite specification. Try vl2png

aborruso commented 1 year ago

Oh! this is a Vega-Lite specification. Try vl2png

And your great vl-convert does not work with Vega-Lite specification file?

Using vl2svg, I have no error and an empty svg file.

aborruso commented 1 year ago

Try vl2png

Using it, it works

jonmmease commented 1 year ago

great!