insertvertex is not rendering the image. 'alt' image is shown

29 Views Asked by At
 createImageShape(imageData) {
    console.log(imageData);
    alert(imageData);
    console.log(mxgraph);
    console.log(mxImage);
    console.log(mxUtils);
    console.log(mxConstants);
    console.log(mxCell);
    console.log(mxGeometry);
    console.log('------------------------------');
    console.log(mxRubberband);
    if (this.initialized && this.graph) {
      console.log(this.graph);
      const x = this.graph;
      
      // Enables rubberband selection
            new mxRubberband(this.graph);

      // Gets the default parent for inserting new cells. This
            // is normally the first child of the root (ie. layer 0).
            var parent = this.graph.getDefaultParent();
                            
            // Adds cells to the model in a single step
            this.graph.getModel().beginUpdate();
            try
            {
                this.graph.insertVertex(parent, null, '', 20, 20, 30, 30, 'shape=image;image=' + imageData);
            }
            finally
            {
                // Updates the display
                this.graph.getModel().endUpdate();
            }

    } else {
      console.log('Initialization is not yet complete');
    }
  }

I am passing the image to createImageShapeFunction. but the image on the canvas is not rendered. when i inspect the rendered object. there is not base64 string inside an image tag.

enter image description here

0

There are 0 best solutions below