-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathSankeyWithLevelsChart.razor
106 lines (99 loc) · 1.89 KB
/
SankeyWithLevelsChart.razor
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
@using Vizor.ECharts;
@if (isInitialized)
{
<Vizor.ECharts.EChart Options="@options" ExternalDataSources="@(new[] { extData })" Width="800px" Height="800px" />
}
@code {
// see https://echarts.apache.org/examples/en/editor.html?c=sankey-levels
private ExternalDataSource? extData = null;
private ChartOptions? options = null;
private bool isInitialized = false;
protected override void OnInitialized()
{
extData = new ExternalDataSource("data/sankey_simple.json", ExternalDataFetchAs.Json);
options = new()
{
Title = new()
{
Text = "Sankey Diagram"
},
Tooltip = new()
{
Trigger = ECharts.TooltipTrigger.Item,
TriggerOn = TriggerOn.MouseMove
},
Series = new()
{
new SankeySeries()
{
Data = new ExternalDataSourceRef(extData, path: "nodes"),
Links = new ExternalDataSourceRef(extData, path: "links"),
Emphasis = new()
{
Focus = "adjacency"
},
Levels = new List<SankeySeriesLevel>()
{
new()
{
Depth = 0,
ItemStyle = new()
{
Color = "#fbb4ae"
},
LineStyle = new()
{
Color = "source",
Opacity = 0.6
}
},
new()
{
Depth = 1,
ItemStyle = new()
{
Color = "#b3cde3"
},
LineStyle = new()
{
Color = "source",
Opacity = 0.6
}
},
new()
{
Depth = 2,
ItemStyle = new()
{
Color = "#ccebc5"
},
LineStyle = new()
{
Color = "source",
Opacity = 0.6
}
},
new()
{
Depth = 3,
ItemStyle = new()
{
Color = "#decbe4"
},
LineStyle = new()
{
Color = "source",
Opacity = 0.6
}
}
},
LineStyle = new()
{
Curveness = 0.5
}
}
}
};
isInitialized = true;
}
}