You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: blazor/sankey/customization.md
+28-38Lines changed: 28 additions & 38 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,19 +1,19 @@
1
1
---
2
2
layout: post
3
3
title: Customization for Blazor Sankey Diagram | Syncfusion
4
-
description: Explore various customization options available for enhancing the Blazor Sankey Diagram with background style, layout, and orientation configuration.
4
+
description: Explore various customization options available for enhancing the Syncfusion Blazor Sankey Diagram with background style, layout, and orientation configuration.
5
5
platform: Blazor
6
6
control: Sankey
7
7
documentation: ug
8
8
---
9
9
10
10
# Blazor Sankey Diagram: Customization
11
11
12
-
The Blazor Sankey Diagram offers extensive customization options to tailor its appearance and behavior to your specific needs. This guide covers customizing the background, dimensions, orientation, and right-to-left (RTL) support.
12
+
The Blazor Sankey Diagram includes extensive options to tailor appearance and behavior. This guide covers background styling, dimensions, right-to-left (RTL) layout, and orientation.
13
13
14
14
## Setting Background
15
15
16
-
You can customize the background of the Sankey Diagram using the `BackgroundColor` and `BackgroundImage` properties. The `BackgroundColor`property allows you to set a solid background color for the chart. You can use any valid CSS color string, including hex codes, named colors, and RGB/RGBA values. The `BackgroundImage`property lets you set a background image for the sankey diagram. Specify the URL or path to the image file.
16
+
Customize the diagram background using `BackgroundColor` and `BackgroundImage`. `BackgroundColor`accepts any valid CSS color (hex, named color, rgb/rgba). `BackgroundImage`applies an image by specifying its URL or file path.
17
17
18
18
{% tabs %}
19
19
{% highlight razor %}
@@ -27,6 +27,7 @@ You can customize the background of the Sankey Diagram using the `BackgroundColo
@@ -190,15 +192,15 @@ Control the sankey diagram's dimensions using the `Width` and `Height` propertie
190
192
191
193
## Right-to-Left (RTL) Support
192
194
193
-
The Blazor Sankey diagram offers built-in support for Right-to-Left (RTL) languages. To enable RTL support, simply set the `EnableRTL`property to `true`. This will flip the entire layout of the Sankey diagram, including nodes, links, and any associated labels or legends.
195
+
Enable RTL by setting `EnableRTL` to `true`. The entire layout—including nodes, links, labels, and legend—adapts to right‑to‑left flow.
194
196
195
-
**When you enable RTL support**
197
+
**Effects of enabling RTL**
196
198
197
-
1.**Node Order**: The order of nodes will be reversed, with the first node appearing on the right side of the diagram.
198
-
2.**Link Direction**: Links between nodes will flow from right to left.
199
-
3.**Labels**: Node and link labels will be aligned to support RTL reading.
200
-
4.**Tooltips**: If enabled, tooltips will be positioned appropriately for RTL layout.
201
-
5.**Legend**: If a legend is present, its layout and order will also be reversed.
199
+
1. Node order is reversed, placing the first node on the right.
200
+
2. Link direction flows right‑to‑left.
201
+
3. Labels align for RTL reading.
202
+
4. Tooltips, if enabled, position appropriately for RTL.
203
+
5. Legendlayout and order are mirrored.
202
204
203
205
{% tabs %}
204
206
{% highlight razor %}
@@ -208,6 +210,7 @@ The Blazor Sankey diagram offers built-in support for Right-to-Left (RTL) langua
@@ -277,37 +280,24 @@ The Blazor Sankey diagram offers built-in support for Right-to-Left (RTL) langua
277
280
278
281
## Orientation
279
282
280
-
The `Orientation` property controls the flow direction of the Sankey Diagram. You can set it to `Horizontal` or `Vertical`. The default `Auto` setting automatically chooses the best orientation based on the sankey diagram's aspect ratio. Setting the orientation to vertical can be particularly useful for certain types of data or when you want to emphasize the top-down flow of information.
281
-
282
-
**When you switch the Sankey Diagram to vertical orientation, several aspects of the Sankey Diagram change:**
283
-
284
-
1.**Node Placement**: Nodes are arranged vertically from top to bottom, instead of left to right.
283
+
Control the flow direction using the `Orientation` property. Values include `Horizontal`, `Vertical`, and `Auto` (default). Vertical orientation can be effective for tall layouts or to emphasize top‑down relationships.
285
284
286
-
2.**Link Direction**: Links flow downward, connecting nodes from top to bottom.
285
+
**Changes in vertical orientation**
287
286
288
-
3.**Label Positioning**:
289
-
- Node labels are typically positioned to the right of each node.
290
-
- Link labels, if enabled, are oriented to align with the vertical flow.
291
-
292
-
4.**Space Utilization**:
293
-
- Vertical orientation often allows for better use of space when dealing with many nodes or long node labels.
294
-
- It can be particularly effective for tall, narrow layouts.
295
-
296
-
5.**Data Interpretation**:
297
-
- The top-down flow can imply a hierarchical or sequential relationship between nodes.
298
-
- It may be more intuitive for certain types of data, such as organizational charts or process flows.
299
-
300
-
6.**Responsiveness**:
301
-
- Vertical layouts can sometimes be more responsive on mobile devices or narrow screen widths.
302
-
303
-
7.**Scrolling Behavior**:
304
-
- For large diagrams, users will scroll vertically instead of horizontally, which can be more natural on most devices.
287
+
1. Nodes are arranged from top to bottom.
288
+
2. Links flow downward between nodes.
289
+
3. Labels align with the vertical flow (node labels typically to the right).
290
+
4. Space can be used more efficiently for many nodes or longer labels.
291
+
5. A top‑down arrangement can imply hierarchical or sequential relationships.
292
+
6. Vertical layouts can be more responsive on narrow screens.
293
+
7. Large diagrams scroll vertically instead of horizontally.
Copy file name to clipboardExpand all lines: blazor/sankey/data-binding.md
+25-25Lines changed: 25 additions & 25 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,43 +1,43 @@
1
1
---
2
2
layout: post
3
3
title: Data Binding for Blazor Sankey Diagram | Syncfusion
4
-
description: Checkout and learn about data binding with Blazor Sankey Diagram and how to implement it effectively.
4
+
description: Learn how to bind nodes and links to the Syncfusion Blazor Sankey Diagram, including data models, REST API binding and JSON response format.
5
5
platform: Blazor
6
6
control: Sankey
7
7
documentation: ug
8
8
---
9
9
10
10
# Data Binding in the Blazor Sankey Diagram
11
11
12
-
The Blazor Sankey Diagram is designed to visualize relationships and flows between categories using nodes and links. Data binding allows you to easily provide the necessary information for the sankey diagram to render effectively. Below, we explore how to bind data to the sankey diagram in Blazor.
12
+
The Blazor Sankey Diagram visualizes relationships and flows between categories using nodes and links. Data binding supplies the node and link information required to render the diagram effectively.
13
13
14
14
## Overview of Data Binding
15
15
16
16
The Sankey Diagram accepts data for:
17
17
18
-
1.**Nodes**: Represent entities or categories in the flow.
19
-
2.**Links**: Represent the connections and their magnitude between the nodes.
18
+
1.**Nodes**: Entities or categories in the flow.
19
+
2.**Links**: Connections between nodes, including the magnitude of each flow.
20
20
21
-
The data can be bound using collections of objects that define the properties of nodes and links. The component dynamically generates the diagram based on this data.
21
+
Bind data using collections of objects that define node and link properties. The component generates the diagram based on this data.
22
22
23
23
## Understanding Data Models
24
-
The Blazor Sankey Diagram uses predefined data models for nodes and links. These models are already available in the `Syncfusion.Blazor.Sankey` namespace. Here's an overview of their key properties:
24
+
The Blazor Sankey Diagram uses predefined data models for nodes and linksavailable in the `Syncfusion.Blazor.Sankey` namespace. Key properties include:
25
25
26
26
### SankeyDataNode
27
-
-`Id`: A string property that serves as a unique identifier for the node.
28
-
-`Label`: An object of type `SankeyDataLabel`that can be used to customize the node's label.
27
+
-`Id`: Unique identifier for the node.
28
+
-`Label`: An instance of `SankeyDataLabel` to customize the node label.
29
29
30
30
### SankeyDataLink
31
-
-`SourceId`: A string property identifying the source node of the link.
32
-
-`TargetId`: A string property identifying the target node of the link.
33
-
-`Value`: A double property representing the weight or magnitude of the connection.
31
+
-`SourceId`: Identifier of the source node.
32
+
-`TargetId`: Identifier of the target node.
33
+
-`Value`: Weight or magnitude of the connection.
34
34
35
-
There's no need to define these classes yourself as they are provided by the Syncfusion<supstyle="font-size:70%">®</sup> library.
35
+
These types are provided by the Syncfusion<supstyle="font-size:70%">®</sup> library; custom class definitions are not required.
36
36
37
37
## Binding Data to the Sankey Diagram
38
-
To use the Sankey Diagram, you need to create collections of `SankeyDataNode` and `SankeyDataLink`objects and bind them to the component. Here's how you can do this.
38
+
Create collections of `SankeyDataNode` and `SankeyDataLink` and assign them to the component.
39
39
40
-
Below is an example of how to bind data to the Sankey Diagram in a Blazor application:
40
+
Below is an example of binding data to the Sankey Diagram in a Blazor application:
41
41
42
42
{% tabs %}
43
43
{% highlight razor %}
@@ -61,7 +61,7 @@ Below is an example of how to bind data to the Sankey Diagram in a Blazor applic
61
61
new SankeyDataNode() { Id = "Green Coffee" },
62
62
new SankeyDataNode() { Id = "North America" },
63
63
new SankeyDataNode() { Id = "Europe" },
64
-
new SankeyDataNode() { Id = "Asia Pacific" },
64
+
new SankeyDataNode() { Id = "Asia Pacific" }
65
65
};
66
66
Links = new List<SankeyDataLink>()
67
67
{
@@ -81,7 +81,7 @@ Below is an example of how to bind data to the Sankey Diagram in a Blazor applic
81
81
new SankeyDataLink() { SourceId = "Instant Coffee", TargetId = "Asia Pacific", Value = 15 },
82
82
new SankeyDataLink() { SourceId = "Green Coffee", TargetId = "North America", Value = 10 },
83
83
new SankeyDataLink() { SourceId = "Green Coffee", TargetId = "Europe", Value = 8 },
84
-
new SankeyDataLink() { SourceId = "Green Coffee", TargetId = "Asia Pacific", Value = 7 },
84
+
new SankeyDataLink() { SourceId = "Green Coffee", TargetId = "Asia Pacific", Value = 7 }
85
85
};
86
86
base.OnInitialized();
87
87
}
@@ -94,16 +94,16 @@ Below is an example of how to bind data to the Sankey Diagram in a Blazor applic
94
94
95
95
### Key Points
96
96
97
-
-The `Nodes` parameter expects a collection of `SankeyDataNode` objects.
98
-
-The `Links` parameter expects a collection of `SankeyDataLink` objects.
99
-
-Ensure that `SourceId` and `TargetId` in `SankeyDataLink` match the `Id` values in `SankeyDataNode`.
97
+
-`Nodes` expects a collection of `SankeyDataNode` objects.
98
+
-`Links` expects a collection of `SankeyDataLink` objects.
99
+
-`SourceId` and `TargetId`values in `SankeyDataLink`must match the corresponding`Id` values in `SankeyDataNode`.
100
100
101
101
## Advanced Binding Scenarios
102
102
103
-
You can bind data from various sources such as:
104
-
- REST APIs: Fetch data dynamically using HTTP requests.
105
-
- Databases: Load data using Entity Framework or similar ORM tools.
106
-
- JSON Files: Deserialize JSON data into the node and link models.
103
+
Data can be sourced from:
104
+
- REST APIs: Fetch data dynamically via HTTP requests.
105
+
- Databases: Load data using Entity Framework or another ORM.
106
+
- JSON files: Deserialize JSON into node and link models.
107
107
108
108
### Example: Binding Data from a REST API
109
109
@@ -138,7 +138,7 @@ You can bind data from various sources such as:
138
138
139
139
140
140
### Updated REST API Example
141
-
Ensure that your API endpoint provides a JSON response in the following format:
141
+
The API endpoint should return a JSON response in the following format:
142
142
143
143
{% tabs %}
144
144
{% highlight json %}
@@ -164,4 +164,4 @@ Ensure that your API endpoint provides a JSON response in the following format:
0 commit comments