exportImage() {
      const oldHeight = this.height;
      const oldWidth = this.width;
      const oldShowTable = this.showTable;
      const ratio = oldWidth / oldHeight;
      const width = 1000;
      const height = Number((width / ratio).toFixed(2));
      this.width = width;
      this.height = height;
      this.showTable = true;
      const canvasRatio = this.width / (this.height + this.tableHeight + (this.tableHeight / 4.5));
      this.canvasHeight = (this.width / canvasRatio).toFixed(2);
      const svg = this.render(false);
      const canvas = document.createElement("canvas");
      const canvasStage = canvas.getContext("2d");
      const image = new Image();

      canvas.width = this.width;
      canvas.height = this.canvasHeight;

      image.onload = () => {
        canvasStage.drawImage(image, 0, 0);
        canvas.toBlob((blob) => {
          const url = URL.createObjectURL(blob);
          this.utility.downloadFile(url, `Export-GraphUI-ImageFile-${new Date().getTime()}.png`);
        }, "image/png", 100);
      };

      image.src = `data:image/svg+xml,${encodeURIComponent(svg.outerHTML)}`;

      this.height = oldHeight;
      this.width = oldWidth;
      this.canvasHeight = null;
      this.showTable = oldShowTable;
      this.render();
    }
/**
     * Generate a PNG image file from the graph data using SVG image and canvas object.
     * @returns {void}
     */
Generate a PNG image file from the graph data using SVG image and canvas object.
@returns {void}
Generate a PNG image file from the graph data using SVG image and canvas object . @returns { void }
exportImage() {
      const oldHeight = this.height;
      const oldWidth = this.width;
      const oldShowTable = this.showTable;
      const ratio = oldWidth / oldHeight;
      const width = 1000;
      const height = Number((width / ratio).toFixed(2));
      this.width = width;
      this.height = height;
      this.showTable = true;
      const canvasRatio = this.width / (this.height + this.tableHeight + (this.tableHeight / 4.5));
      this.canvasHeight = (this.width / canvasRatio).toFixed(2);
      const svg = this.render(false);
      const canvas = document.createElement("canvas");
      const canvasStage = canvas.getContext("2d");
      const image = new Image();
      canvas.width = this.width;
      canvas.height = this.canvasHeight;
      image.onload = () => {
        canvasStage.drawImage(image, 0, 0);
        canvas.toBlob((blob) => {
          const url = URL.createObjectURL(blob);
          this.utility.downloadFile(url, `Export-GraphUI-ImageFile-${new Date().getTime()}.png`);
        }, "image/png", 100);
      };
      image.src = `data:image/svg+xml,${encodeURIComponent(svg.outerHTML)}`;
      this.height = oldHeight;
      this.width = oldWidth;
      this.canvasHeight = null;
      this.showTable = oldShowTable;
      this.render();
    }
exportImage ( ) { const oldHeight = this . height ; const oldWidth = this . width ; const oldShowTable = this . showTable ; const ratio = oldWidth / oldHeight ; const width = 1000 ; const height = Number ( ( width / ratio ) . toFixed ( 2 ) ) ; this . width = width ; this . height = height ; this . showTable = true ; const canvasRatio = this . width / ( this . height + this . tableHeight + ( this . tableHeight / 4.5 ) ) ; this . canvasHeight = ( this . width / canvasRatio ) . toFixed ( 2 ) ; const svg = this . render ( false ) ; const canvas = document . createElement ( "canvas" ) ; const canvasStage = canvas . getContext ( "2d" ) ; const image = new Image ( ) ; canvas . width = this . width ; canvas . height = this . canvasHeight ; image . onload = ( ) => { canvasStage . drawImage ( image , 0 , 0 ) ; canvas . toBlob ( ( blob ) => { const url = URL . createObjectURL ( blob ) ; this . utility . downloadFile ( url , ` ${ new Date ( ) . getTime ( ) } ` ) ; } , "image/png" , 100 ) ; } ; image . src = ` ${ encodeURIComponent ( svg . outerHTML ) } ` ; this . height = oldHeight ; this . width = oldWidth ; this . canvasHeight = null ; this . showTable = oldShowTable ; this . render ( ) ; }
Generate a PNG image file from the graph data using SVG image and canvas object.
Generate a PNG image file from the graph data using SVG image and canvas object .