src/simg.js
function(filename){
      if (!filename){
        filename = 'chart';
      }
      this.toImg(function(img){
        var a = document.createElement("a");
        // Name of the file being downloaded.
        a.download = filename + ".png";
        a.href = img.getAttribute('src');
        // Support for Firefox which requires inserting in dom.
        a.style.display = 'none';
        document.body.appendChild(a);
        a.click();
        document.body.removeChild(a);
      });
    }
function(filename){
      if (!filename){
        filename = 'chart';
      }
      this.toImg(function(img){
        var a = document.createElement("a");
        // Name of the file being downloaded.
        a.download = filename + ".png";
        a.href = img.getAttribute('src');
        // Support for Firefox which requires inserting in dom.
        a.style.display = 'none';
        document.body.appendChild(a);
        a.click();
        document.body.removeChild(a);
      });
    }
function ( filename ) { if ( ! filename ) { filename = 'chart' ; } this . toImg ( function ( img ) { var a = document . createElement ( "a" ) ; // Name of the file being downloaded. a . download = filename + ".png" ; a . href = img . getAttribute ( 'src' ) ; // Support for Firefox which requires inserting in dom. a . style . display = 'none' ; document . body . appendChild ( a ) ; a . click ( ) ; document . body . removeChild ( a ) ; } ) ; }
Trigger download of image.
Trigger download of image .