Articles in this section
Category / Section

How to set the background image to the Diagram in JavaScript?

1 min read

Background Image support in Diagram

The diagram supports to set the background image to the diagram with custom properties to stretch and align the background image anywhere over the diagram area. The source property of backgroundImage allows you to set the path of the image.

 

The scale and the align properties help to stretch or align the background images.

Refer to the following code example to initialize the background image.

backgroundImage: {
 alignment:ej.datavisualization.Diagram.ImageAlignment.XMidYMin,
 scale: "meet",
 // online image link source:https://ej2.syncfusion.com/demos/src/diagram/employees/image2.png
 }

 

Refer to the sample to show the background image to the diagram.

Link: https://jsplayground.syncfusion.com/l3fbehas

Note:

The background of page settings is laid over the background image. So, set the transparent color to the pageBackgroundColor property of pageSettings to display the background image. Refer to the properties of backgroundImage and pagesettings.

 

Conclusion

I hope you enjoyed learning about how to set the background image to the Diagram.

You can refer to our JavaScript Diagram feature tour page to know about its other groundbreaking feature representations and documentation, and how to quickly get started for configuration specifications. You can also explore our JavaScript Diagram example to understand how to create and manipulate data.

For current customers, you can check out our components from the License and Downloads page. If you are new to Syncfusion, you can try our 30-day free trial to check out our other controls.

If you have any queries or require clarifications, please let us know in the comments section below. You can also contact us through our support forumsDirect-Trac, or feedback portal. We are always happy to assist you!

Did you find this information helpful?
Yes
No
Help us improve this page
Please provide feedback or comments
Comments (0)
Please  to leave a comment
Access denied
Access denied