Articles in this section
Category / Section

How to Control the Size of a Symbol in JavaScript Diagram?

2 mins read

When configuring the SymbolPalette in the Syncfusion® JavaScript Diagram component, the symbolWidth and symbolHeight properties play a key role in defining the size of each symbol displayed in the palette. By setting these properties, you ensure all symbols are uniformly scaled to fit the specified dimensions, maintaining a consistent appearance across the palette.
However, if your design requirements call for symbols with varying dimensions, you can achieve this flexibility by omitting the symbolWidth and symbolHeight properties from the SymbolPalette configuration. Instead, you can specify individual width and height values directly within each symbol’s node definition.
This approach allows you to tailor the size of each symbol according to your specific layout needs, offering a more customized and dynamic presentation within your application.

{
   id: 'Terminator', addInfo: { tooltip: 'Terminator' }, width: 50, height: 60, shape: { type: 'Flow', shape: 'Terminator' }
},
{
   id: 'Process', addInfo: { tooltip: 'Process' }, width: 50, height: 60, shape: { type: 'Flow', shape: 'Process' }
},
{
   id: 'Decision', addInfo: { tooltip: 'Decision' }, width: 50, height: 60, shape: { type: 'Flow', shape: 'Decision' }
},
{
   id: 'Document', addInfo: { tooltip: 'Document' }, width: 50, height: 50, shape: { type: 'Flow', shape: 'Document' }
},
{
   id: 'PreDefinedProcess', addInfo: { tooltip: 'Predefined process' }, width: 50, height: 50, shape: { type: 'Flow', shape: 'PreDefinedProcess' }
},
{
   id: 'data', width: 50, height: 50, addInfo: { tooltip: 'Data' }, shape: { type: 'Flow', shape: 'Data' }
}, 

By using this method, you gain precise control over the size of each symbol, enhancing the visual diversity and adaptability of the SymbolPalette to meet the unique requirements of your application.
Kindly refer to the working sample below:
Sample

Conclusion

I hope you enjoyed learning on how to control the size of a specific symbol in the SymbolPalette of JavaScript 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 forums, Direct-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