Class Palette
The Palette shows a set of nodes and connectors. It allows you to drag and drop the nodes and connectors into the Diagram.
Inherited Members
Namespace: Syncfusion.JavaScript.DataVisualization.Models
Assembly: Syncfusion.EJ.dll
Syntax
public class Palette : EJTagHelper
Constructors
Palette()
Declaration
public Palette()
Palette(Palette)
Initializes a new instance of the Palette class.
Declaration
public Palette(Palette src)
Parameters
| Type | Name | Description |
|---|---|---|
| Palette | src | The SRC. |
Palette(String)
Initializes a new instance of the Palette class.
Declaration
public Palette(string paletteName)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | paletteName | The palette Name. |
Properties
AddInfo
Gets or sets the additional information about the palette.
Declaration
[JsonProperty("addInfo")]
public object AddInfo { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Object | null |
Examples
          SymbolPaletteProperties SymbolPalette = new SymbolPaletteProperties();
          SymbolPalette.Palettes = new Collection();
          Dictionary<string,string> AddInfo=new Dictionary<string,string>();
          AddInfo.Add("custom property","custom value");
          Palette Palette = new Palette("Connector") { Name = "Connector",AddInfo= };
          Palette.Items.Add(new Node() { Name = "node1", OffsetX = 100, OffsetY = 100, Height = 100, Width = 100 });
Capacity
Gets or sets the capacity of palette.
Declaration
public int Capacity { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Int32 | The capacity. |
ChildCount
Gets the palette child count.
Declaration
public int ChildCount { get; }
Property Value
| Type | Description |
|---|---|
| System.Int32 |
Constraints
Gets or sets the default behaviors of the palette
Declaration
[JsonProperty("constraints")]
[JsonConverter(typeof(StringEnumConverter))]
public PaletteConstraints Constraints { get; set; }
Property Value
| Type | Description |
|---|---|
| PaletteConstraints | String.Empty |
Examples
         Â
          SymbolPaletteProperties SymbolPalette = new SymbolPaletteProperties();
          SymbolPalette.Palettes = new Collection();
          Palette Palette = new Palette("Connector") { Name = "Connector", Constraints = PaletteConstraints.HeaderVisibility };
Expanded
Gets or sets whether the palette group should be expanded or closed.
Declaration
[JsonProperty("expanded")]
public bool Expanded { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Boolean | false |
Examples
          SymbolPaletteProperties SymbolPalette = new SymbolPaletteProperties();
          SymbolPalette.Palettes = new Collection();
          Palette Palette = new Palette("Connectors");
          Palette.Expanded = true;     Â
Items
Gets or sets collection of diagram objectes grouped as pallete
Declaration
[JsonProperty("items")]
public Collection Items { get; set; }
Property Value
| Type | Description |
|---|---|
| Collection | Collection |
Examples
          SymbolPaletteProperties SymbolPalette = new SymbolPaletteProperties();
          SymbolPalette.Palettes = new Collection();
          Palette Palette = new Palette("Connector") { Name = "Connector" };
          Palette.Items.Add(new Node() { Name = "node1", OffsetX = 100, OffsetY = 100, Height = 100, Width = 100 });
Name
Gets or sets the unique identifier of the palette
Declaration
[JsonProperty("name")]
public string Name { get; set; }
Property Value
| Type | Description |
|---|---|
| System.String | String.Empty |
Examples
           SymbolPaletteProperties SymbolPalette = new SymbolPaletteProperties();
          SymbolPalette.Palettes = new Collection();
          Palette Palette = new Palette("Connector") { Name = "Connector" };
SubControlId
Declaration
[JsonProperty("subControlId")]
public string SubControlId { get; set; }
Property Value
| Type | Description |
|---|---|
| System.String |
TemplateId
Gets or sets the template to bind on the palette header
Declaration
[JsonProperty("templateId")]
public string TemplateId { get; set; }
Property Value
| Type | Description |
|---|---|
| System.String | String.Empty |
Examples
  <script id="svgTemplate" type="text/x-jsrender">
      <svg version="1.0" xmlns="http://www.w3.org/2000/svg" width="225px" height="32px" viewBox="0 -5 225 32">
          <g visibility="visible">
              <image width="20px" height="20px" opacity="1" xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="{{:addInfo.source}}"></image>
              <text x="40" y="18" font-size="14">
                  <tspan>{{:name}}</tspan>
              </text>
          </g>
      </svg>
  </script>
          SymbolPaletteProperties SymbolPalette = new SymbolPaletteProperties();
          SymbolPalette.Palettes = new Collection();
          Palette Palette = new Palette("Connector") { Name = "Connector", TemplateId = "svgTemplate" };
          Palette.Items.Add(new Node() { Name = "node1", OffsetX = 100, OffsetY = 100, Height = 100, Width = 100 });
Methods
AppendChild(Connector)
Appends the connector to the palette collection.
Declaration
public void AppendChild(Connector connector)
Parameters
| Type | Name | Description |
|---|---|---|
| Connector | connector | The connector. |
AppendChild(NodeBase)
Appends the node to the palette collection.
Declaration
public void AppendChild(NodeBase node)
Parameters
| Type | Name | Description |
|---|---|---|
| NodeBase | node | The node. |
Clear()
It allows to clear the palette children collection
Declaration
public void Clear()
Examples
           Palette Palette = new Palette("Connector") { };
          Palette.Clear();     Â
Clone()
Performs a deep copy of the set of matched elements, meaning that it copies the matched elements as well as all of their descendant elements.
Declaration
public object Clone()
Returns
| Type | Description |
|---|---|
| System.Object | object |
Examples
           Palette Palette = new Palette("Connector") { };
          Palette.Clone();     Â
Contains(Connector)
Determines whether the palette contains the specified connector.
Declaration
public bool Contains(Connector connector)
Parameters
| Type | Name | Description |
|---|---|---|
| Connector | connector | The connector. |
Returns
| Type | Description |
|---|---|
| System.Boolean |
|
Contains(NodeBase)
Determines whether the palette contains the specified node.
Declaration
public bool Contains(NodeBase node)
Parameters
| Type | Name | Description |
|---|---|---|
| NodeBase | node | The node. |
Returns
| Type | Description |
|---|---|
| System.Boolean |
|
GetChild(Int32)
Gets the child at the specified index.
Declaration
public object GetChild(int index)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Int32 | index | The index. |
Returns
| Type | Description |
|---|---|
| System.Object | The child. |
RemoveChild(Connector)
Removes the specified child.
Declaration
public void RemoveChild(Connector connector)
Parameters
| Type | Name | Description |
|---|---|---|
| Connector | connector | The connector. |
RemoveChild(NodeBase)
Removes the specified child.
Declaration
public void RemoveChild(NodeBase node)
Parameters
| Type | Name | Description |
|---|---|---|
| NodeBase | node | The node. |
RemoveChild(Int32)
Removes the child at the specified index.
Declaration
public void RemoveChild(int index)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Int32 | index | The index. |