Skip to content

simg.js:37 Uncaught TypeError: svg.setAttribute is not a function #15

Description

@FlorianLeitgeb

I have a d3 graph within a svg element and wanted to export it. Just grabbed the svg element and called simg like shown in your example:

function exportToPNG() {
  var simg = new Simg(document.getElementsByTagName("svg"));
  // Replace the current SVG with an image version of it.
  simg.replace();

  // And trigger a download of the rendered image.
  simg.download();
}

simg.js:37 Uncaught TypeError: svg.setAttribute is not a function
    at simg.js:37
    at Array.forEach (<anonymous>)
    at root.Simg.toString (simg.js:36)
    at root.Simg.toSvgImage (simg.js:57)
    at root.Simg.toCanvas (simg.js:44)
    at root.Simg.toImg (simg.js:74)
    at root.Simg.replace (simg.js:90)
    at exportToPNG (itsv.pws.ui.projStruct.js?ver:50)
    at HTMLAnchorElement.onclick (ProjStruct.aspx:1)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions