Black Lives Matter. Please consider donating to Black Girls Code today.

Table Margins & Table toImage

We are using the table type to display data under some charts. I’d like the table to fit the width of the canvas as defined by the margins set. The table doesn’t appear to have any margins in the styles documentation I’ve found.

One the same topic with the table margins, when we convert the plot to an SVG using toImage, the bottom portion of the table is cutoff due to some strange margin.

The attached image shows the left/right margins of the table and the bottom portion of the table is cutoff. When the table is viewed as HTML, the bottom portion of the table shows, just on conversion to SVG does it get cut off.

That looks like a bug.

Would you mind sharing a reproducible example to help us out?

Here is a Codepen of my code.

Our process is as follows:

  1. Generate plot using loadFigures() function
  2. Call saveImage() function to convert plot to SVG and grab SVG source code
  3. Use Java batik transcoder to convert the SVG source code to a PNG.

When I grab the SVG source code from the textarea in the Codepen example and create a test SVG file to load in a browser (Chrome), the image is still cut off so I feel like the batik transcoder is not the issue. When I use the download button in the mode bar to download as png directly, it works without cutting off the bottom of the table.

I am thinking it is a margin issue as it doesn’t seem like the margins of the canvas set in layout are being adhered to for the table.

Thanks,

Marcus