Class SankeyLabels
Represents the label settings for nodes in the SfSankey.
Inheritance
Namespace: Syncfusion.Blazor.Sankey
Assembly: Syncfusion.Blazor.dll
Syntax
public class SankeyLabels : SankeyComponentBase, ISankeyFontStyle
Examples
<SfSankey Width="600px" Height="400px" DataSource="@SankeyData">
<SankeyNodes Width="30" Alignment="SankeyNodeAlign.Left" Offset="10" Padding="10">
</SankeyNodes>
<SankeyLinks Color="blue" ColorType="ColorType.Source" HighlightOpacity="1" InactiveOpacity="0.3" Opacity="0.7"> </SankeyLinks>
<SankeyLabels Visible="true" FontSize="12" Color="black" FontFamily="Arial" FontWeight="400" Padding="8"></SankeyLabels>
</SfSankey>
@code {
public SankeyData SankeyData = new SankeyData()
{
Nodes = new List<SankeyDataNode>(),
Links = new List<SankeyDataLink>()
};
protected override void OnInitialized()
{
base.OnInitialized();
SankeyData.Nodes = new List<SankeyDataNode>()
{
new SankeyDataNode() { Id = "Female", Label = new SankeyDataLabel() { Text = "Female (58%)" } },
new SankeyDataNode() { Id = "Male", Label = new SankeyDataLabel() { Text = "Male (42%)" } },
new SankeyDataNode() { Id = "Tablet", Label = new SankeyDataLabel() { Text = "Tablet (12%)" } },
new SankeyDataNode() { Id = "Mobile", Label = new SankeyDataLabel() { Text = "Mobile (40%)" } },
new SankeyDataNode() { Id = "Desktop", Label = new SankeyDataLabel() { Text = "Desktop (48%)" } },
new SankeyDataNode() { Id = "< 18", Label = new SankeyDataLabel() { Text = "< 18 years (8%)" } },
new SankeyDataNode() { Id = "18-26", Label = new SankeyDataLabel() { Text = "18-26 years (35%)" } },
new SankeyDataNode() { Id = "27-40", Label = new SankeyDataLabel() { Text = "27-40 years (38%)" } },
new SankeyDataNode() { Id = "> 40", Label = new SankeyDataLabel() { Text = "> 40 years (19%)" } }
};
SankeyData.Links = new List<SankeyDataLink>()
{
new SankeyDataLink() { SourceId = "Female", TargetId = "Tablet", Value = 12 },
new SankeyDataLink() { SourceId = "Female", TargetId = "Mobile", Value = 14 },
new SankeyDataLink() { SourceId = "Female", TargetId = "Desktop", Value = 32 },
new SankeyDataLink() { SourceId = "Male", TargetId = "Mobile", Value = 26 },
new SankeyDataLink() { SourceId = "Male", TargetId = "Desktop", Value = 16 },
new SankeyDataLink() { SourceId = "Tablet", TargetId = "< 18", Value = 4 },
new SankeyDataLink() { SourceId = "Tablet", TargetId = "> 40", Value = 8 },
new SankeyDataLink() { SourceId = "Mobile", TargetId = "< 18", Value = 4 },
new SankeyDataLink() { SourceId = "Mobile", TargetId = "18-26", Value = 24 },
new SankeyDataLink() { SourceId = "Mobile", TargetId = "27-40", Value = 10 },
new SankeyDataLink() { SourceId = "Mobile", TargetId = "> 40", Value = 2 },
new SankeyDataLink() { SourceId = "Desktop", TargetId = "18-26", Value = 11 },
new SankeyDataLink() { SourceId = "Desktop", TargetId = "27-40", Value = 28 },
new SankeyDataLink() { SourceId = "Desktop", TargetId = "> 40", Value = 9 }
};
}
}
Constructors
SankeyLabels()
Declaration
public SankeyLabels()
Properties
Color
Gets or sets the color of the label text.
Declaration
public string Color { get; set; }
Property Value
Type | Description |
---|---|
System.String | A string value specifying the color of the label text. The default value is null. |
Remarks
When the value is null, the label text color is automatically determined based on the Theme.
FontFamily
Gets or sets the font family of the label text.
Declaration
public string FontFamily { get; set; }
Property Value
Type | Description |
---|---|
System.String | A string value specifying the font family used for the label. The default value is null. |
FontSize
Gets or sets the font size of the label text.
Declaration
public string FontSize { get; set; }
Property Value
Type | Description |
---|---|
System.String | A string value representing the size of the font. The default value is null. |
Remarks
Use this property to set the font size of the label text. The value should be in pixel units. For example, "12px". When the value is null, the font size is automatically determined based on the Theme.
FontStyle
Gets or sets the font style of the label text.
Declaration
public string FontStyle { get; set; }
Property Value
Type | Description |
---|---|
System.String | A string value specifying the font style (e.g., italic). The default value is null. |
Remarks
Set this property to specify the font style of the label text. The value should be one of the following: "normal", "italic", or "oblique". If the value is null, the font style is automatically determined based on the Theme.
FontWeight
Gets or sets the font weight of the label text.
Declaration
public string FontWeight { get; set; }
Property Value
Type | Description |
---|---|
System.String | A string value specifying the weight of the font (e.g., bold). The default value is null. |
Remarks
Use this property to set the font weight of the label text. The value should be one of the following: "normal", "bold", "bolder", "lighter", "100", "200", "300", "400", "500", "600", "700", "800", or "900". When the value is null, the font weight is automatically determined based on the Theme.
Padding
Gets or sets the padding inside the label.
Declaration
public double Padding { get; set; }
Property Value
Type | Description |
---|---|
System.Double | A double value representing the padding around the label text. The default value is 10. |
Remarks
By default, the padding is 10 pixels. Use this property to adjust the padding around the label text.
Visible
Gets or sets a value indicating whether the label is visible.
Declaration
public bool Visible { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean | A boolean value that indicates if the label is visible. The default value is true. |
Remarks
Use this property to show or hide the label. When the value is true, the label is visible; otherwise, it is hidden.
Methods
GetFontKey()
Declaration
public string GetFontKey()
Returns
Type |
---|
System.String |
GetTextStyle()
Declaration
public ISankeyThemeTextStyle GetTextStyle()
Returns
Type |
---|
Syncfusion.Blazor.Sankey.Internal.ISankeyThemeTextStyle |