SVGs in the diagram do not load

I'm having a problem after saving the diagram, more precisely when using the loadDiagram function. My nodes are svgs and I have one node that renders normally and the others only after clicking on them. Before saving they render normally.

getDiagram(diagramProject: string) {
    if (this.
diagram) {
      try {
        this.
diagram.refresh();
        const parsedDiagram = JSON.
parse(diagramProject); // Tenta parsear a string JSON
        this.
diagram.loadDiagram(parsedDiagram); // Carrega o diagrama
        this.
diagram.dataBind(); // Aplica as mudanças no diagrama
        this.
schemDiagramService.setDiagram(this.diagram);
      } catch (
error) {
        console.
error('Erro ao carregar o diagrama: ', error);
      }
    } else {
      console.
log('O diagrama ainda não foi carregado.');
    }
  }


Attachment: diagram_db292cae.zip

5 Replies

MG Moulidharan Gopalakrishnan Syncfusion Team October 9, 2024 12:24 PM UTC

Hi,


We can replicate the reported issue with your JSON. we will validate and update you as earlier as possible.


Regards,
Moulidharan



NP Natália Pereira Almeida Ferreira October 10, 2024 01:46 PM UTC

ok, I'm waiting



MG Moulidharan Gopalakrishnan Syncfusion Team October 11, 2024 01:03 PM UTC

Hi,


We tested the sample you shared and found that nodes are assigned the same zIndex. Each diagram element should have a unique zIndex. In your sample, all the 3 nodes has same "z-index" values which is causing the issue.

zIndex is typically calculated automatically by the diagram, and it is not recommended to set it manually in the application. Could you please confirm whether the zIndex values were set by you or if they were generated by saveDiagram? Understanding your reason for manually setting the zIndex will help us provide the most appropriate solution.

In the meantime, please assign different zIndex values to these nodes to resolve the issue. please refer the modified Json



Regards,

Moulidharan


Attachment: diagramsyncfusion_993f98ef.zip


NP Natália Pereira Almeida Ferreira October 11, 2024 01:32 PM UTC

Thanks, it worked by removing zindex!



PR Preethi Rajakandham Syncfusion Team October 14, 2024 06:37 AM UTC

Hi Natália Pereira Almeida Ferreira,

You're welcome. 

We are glad that the provided response meets your requirement. Please let us know if you need further assistance. As always, we are happy to help you out. 

Regards,

Preethi R


Loader.
Up arrow icon