How to add a label to a palette symbol?

How can we add a label to a palette symbol? 



3 Replies

SG Shyam G Syncfusion Team May 6, 2022 06:58 AM UTC

Hi Dante,


We have an option to add a description/label for palette symbol item as shown in the below screenshot. We should use getSymbolInfo function in which you can set the description/label for the palette symbols using text property. Please refer to a code example and the help documentation below.


Code example:

Index.cshtml file

 

function getSymbolInfo(symbol) {

if (symbol['text'] !== undefined) {

 return {

//Add or Remove the Text for Symbol palette item.

description: { //Defines the symbol description

text: symbol['text'],

} }; }  

 



Help documentation: https://ej2.syncfusion.com/aspnetmvc/documentation/diagram/symbol-palette#adding-symbol-description-for-symbols-in-the-palette


Screenshot:


Regards,

Shyam G



DG Dante Galicia May 6, 2022 12:33 PM UTC

Hi Shyam,  Is it possible to add the description when creating the symbol?  for example like this (Blazor):

 new DiagramNode() 
            { 
                Id = "process", 
                Shape = new DiagramShape() 
                { 
                    Type = Shapes.Flow, 
                    FlowShape = Syncfusion.Blazor.Diagrams.FlowShapes.Process 
                }, 
                // Sets symbol description for process shape. 
                SymbolInfo= new SymbolInfo() 
                { 
                    Description= new Syncfusion.Blazor.Diagrams.SymbolDescription 
                    { 
                        Text="Process" 
                    } 
                } 
            }, 


AR Aravind Ravi Syncfusion Team May 9, 2022 12:35 PM UTC

Hi Dante,


No, we cannot able to add the description when creating a symbol like a blazor. Instead of adding description, by using the addInfo property we can able to add additional information for the nodes. AddInfo property of a node is an object type, so you can set it as an array, number, or string type. So in addInfo property, you can set a description for the node and set that description to the symbol description property in getSymbolInfo function. Please refer to the below code snippet


List<DiagramNode> flowShapes = new List<DiagramNode>();

            flowShapes.Add(new FlowShapes() { Id = "Terminator", Shape = new { type = "Flow", shape = "Terminator" }, AddInfo="Terminator" });

 

//cshtml

function getSymbolInfo(symbol) {

            return {

                width: 75,

                height: 40,

                description: { text: symbol.addInfo, overflow: 'Wrap' }

            }

        }



We have attached a sample of how to add a description for the symbol using symbol info. Please refer to the sample in the below link


Sample: https://www.syncfusion.com/downloads/support/directtrac/general/ze/Palette-SymbolInfo-210294179


Regards

Aravind Ravi


Loader.
Up arrow icon