@@ -5,8 +5,78 @@ import ReactDOM from 'react-dom';
5
5
const DemoSankey = ( ) => {
6
6
const config = {
7
7
data : {
8
- type : 'fetch' ,
9
- value : 'https://assets.antv.antgroup.com/g2/energy.json' ,
8
+ value : {
9
+ links : [
10
+ { source : "Agricultural 'waste'" , target : 'Bio-conversion' , value : 124.729 } ,
11
+ { source : 'Bio-conversion' , target : 'Liquid' , value : 0.597 } ,
12
+ { source : 'Bio-conversion' , target : 'Losses' , value : 26.862 } ,
13
+ { source : 'Bio-conversion' , target : 'Solid' , value : 280.322 } ,
14
+ { source : 'Bio-conversion' , target : 'Gas' , value : 81.144 } ,
15
+ { source : 'Biofuel imports' , target : 'Liquid' , value : 35 } ,
16
+ { source : 'Biomass imports' , target : 'Solid' , value : 35 } ,
17
+ { source : 'Coal imports' , target : 'Coal' , value : 11.606 } ,
18
+ { source : 'Coal reserves' , target : 'Coal' , value : 63.965 } ,
19
+ { source : 'Coal' , target : 'Solid' , value : 75.571 } ,
20
+ { source : 'District heating' , target : 'Industry' , value : 10.639 } ,
21
+ { source : 'District heating' , target : 'Heating and cooling - commercial' , value : 22.505 } ,
22
+ { source : 'District heating' , target : 'Heating and cooling - homes' , value : 46.184 } ,
23
+ { source : 'Electricity grid' , target : 'Over generation / exports' , value : 104.453 } ,
24
+ { source : 'Electricity grid' , target : 'Heating and cooling - homes' , value : 113.726 } ,
25
+ { source : 'Electricity grid' , target : 'H2 conversion' , value : 27.14 } ,
26
+ { source : 'Electricity grid' , target : 'Industry' , value : 342.165 } ,
27
+ { source : 'Electricity grid' , target : 'Road transport' , value : 37.797 } ,
28
+ { source : 'Electricity grid' , target : 'Agriculture' , value : 4.412 } ,
29
+ { source : 'Electricity grid' , target : 'Heating and cooling - commercial' , value : 40.858 } ,
30
+ { source : 'Electricity grid' , target : 'Losses' , value : 56.691 } ,
31
+ { source : 'Electricity grid' , target : 'Rail transport' , value : 7.863 } ,
32
+ { source : 'Electricity grid' , target : 'Lighting & appliances - commercial' , value : 90.008 } ,
33
+ { source : 'Electricity grid' , target : 'Lighting & appliances - homes' , value : 93.494 } ,
34
+ { source : 'Gas imports' , target : 'Ngas' , value : 40.719 } ,
35
+ { source : 'Gas reserves' , target : 'Ngas' , value : 82.233 } ,
36
+ { source : 'Gas' , target : 'Heating and cooling - commercial' , value : 0.129 } ,
37
+ { source : 'Gas' , target : 'Losses' , value : 1.401 } ,
38
+ { source : 'Gas' , target : 'Thermal generation' , value : 151.891 } ,
39
+ { source : 'Gas' , target : 'Agriculture' , value : 2.096 } ,
40
+ { source : 'Gas' , target : 'Industry' , value : 48.58 } ,
41
+ { source : 'Geothermal' , target : 'Electricity grid' , value : 7.013 } ,
42
+ { source : 'H2 conversion' , target : 'H2' , value : 20.897 } ,
43
+ { source : 'H2 conversion' , target : 'Losses' , value : 6.242 } ,
44
+ { source : 'H2' , target : 'Road transport' , value : 20.897 } ,
45
+ { source : 'Hydro' , target : 'Electricity grid' , value : 6.995 } ,
46
+ { source : 'Liquid' , target : 'Industry' , value : 121.066 } ,
47
+ { source : 'Liquid' , target : 'International shipping' , value : 128.69 } ,
48
+ { source : 'Liquid' , target : 'Road transport' , value : 135.835 } ,
49
+ { source : 'Liquid' , target : 'Domestic aviation' , value : 14.458 } ,
50
+ { source : 'Liquid' , target : 'International aviation' , value : 206.267 } ,
51
+ { source : 'Liquid' , target : 'Agriculture' , value : 3.64 } ,
52
+ { source : 'Liquid' , target : 'National navigation' , value : 33.218 } ,
53
+ { source : 'Liquid' , target : 'Rail transport' , value : 4.413 } ,
54
+ { source : 'Marine algae' , target : 'Bio-conversion' , value : 4.375 } ,
55
+ { source : 'Ngas' , target : 'Gas' , value : 122.952 } ,
56
+ { source : 'Nuclear' , target : 'Thermal generation' , value : 839.978 } ,
57
+ { source : 'Oil imports' , target : 'Oil' , value : 504.287 } ,
58
+ { source : 'Oil reserves' , target : 'Oil' , value : 107.703 } ,
59
+ { source : 'Oil' , target : 'Liquid' , value : 611.99 } ,
60
+ { source : 'Other waste' , target : 'Solid' , value : 56.587 } ,
61
+ { source : 'Other waste' , target : 'Bio-conversion' , value : 77.81 } ,
62
+ { source : 'Pumped heat' , target : 'Heating and cooling - homes' , value : 193.026 } ,
63
+ { source : 'Pumped heat' , target : 'Heating and cooling - commercial' , value : 70.672 } ,
64
+ { source : 'Solar PV' , target : 'Electricity grid' , value : 59.901 } ,
65
+ { source : 'Solar Thermal' , target : 'Heating and cooling - homes' , value : 19.263 } ,
66
+ { source : 'Solar' , target : 'Solar Thermal' , value : 19.263 } ,
67
+ { source : 'Solar' , target : 'Solar PV' , value : 59.901 } ,
68
+ { source : 'Solid' , target : 'Agriculture' , value : 0.882 } ,
69
+ { source : 'Solid' , target : 'Thermal generation' , value : 400.12 } ,
70
+ { source : 'Solid' , target : 'Industry' , value : 46.477 } ,
71
+ { source : 'Thermal generation' , target : 'Electricity grid' , value : 525.531 } ,
72
+ { source : 'Thermal generation' , target : 'Losses' , value : 787.129 } ,
73
+ { source : 'Thermal generation' , target : 'District heating' , value : 79.329 } ,
74
+ { source : 'Tidal' , target : 'Electricity grid' , value : 9.452 } ,
75
+ { source : 'UK land based bioenergy' , target : 'Bio-conversion' , value : 182.01 } ,
76
+ { source : 'Wave' , target : 'Electricity grid' , value : 19.013 } ,
77
+ { source : 'Wind' , target : 'Electricity grid' , value : 289.366 } ,
78
+ ] ,
79
+ } ,
10
80
} ,
11
81
scale : {
12
82
color : {
@@ -31,6 +101,19 @@ const DemoSankey = () => {
31
101
nodeStrokeWidth : 1.2 ,
32
102
linkFillOpacity : 0.4 ,
33
103
} ,
104
+ interaction : {
105
+ tooltip : {
106
+ render : ( e , { title, items } ) => {
107
+ console . log ( title , items ) ;
108
+ // const div = document.createElement('div');
109
+ // const h3 = document.createElement('h3');
110
+ // h3.innerHTML = title;
111
+ // div.appendChild(h3);
112
+ // div.innerHTML = `${source} → ${target}: ${value}`;
113
+ return < div > 123</ div > ;
114
+ } ,
115
+ } ,
116
+ } ,
34
117
} ;
35
118
return < Sankey { ...config } /> ;
36
119
} ;
0 commit comments