#r #plotly #sankey-diagram
Вопрос:
Я использовал код в визуализации R в SAP Analytics Cloud. На данный момент значения отображаются только при наведении курсора мыши на узел. Но управляющие ребята хотят постоянно видеть значения на узлах. это мой код на данный момент:
#input data
Sys.setlocale("LC_ALL", "de_DE.UTF-8")
library('plotly')
plot_ly(
type = 'sankey',
orientation = 'v',
textfont = list(size=15),
node = list(
label = c("Net Sales III", "Gross Margin", "Costs of Material",
"Base Contribution", "Bonus/Malus(incl. Leftover)", "Service Charge Division Costs", "Logistic Costs",
"EBIT", "Fixed Costs Sales", "Marketing Costs"),
x = c(0,0.3, 0.3, 0.6, 0.6, 0.6, 0.6, 0.9, 0.9, 0.9),
y = c(0.1,0.25, 0.8, 0.13, 0.3, 0.4, 0.6, 0.055, 0.2, 0.3),
color = c("C0A468", "C0A468", "EDD38E","C0A468", "EDD38E","EDD38E", "EDD38E","C0A468", "EDD38E", "EDD38E") ,
pad = 30, # Zwischenraum
thickness = 30, #Dicke der Nodes
line = list(
color = "black",
width = 1
)
),
link = list(
source = c(0,0,1,1,1,1,3,3,3),
target = c(1,2,3,4,5,6,7,8,9),
value = c(R_BHP_L_GCO_001_PCA_G002_Sankey
Gross Margin',
-R_BHP_L_GCO_001_PCA_G002_Sankey
Costs of Material',
R_BHP_L_GCO_001_PCA_G002_Sankey
Base Contribution',
R_BHP_L_GCO_001_PCA_G002_Sankey
Bonus/Malus (incl. Leftover)',
-R_BHP_L_GCO_001_PCA_G002_Sankey
Service Charge Division Costs',
-R_BHP_L_GCO_001_PCA_G002_Sankey
Logistic Costs',
R_BHP_L_GCO_001_PCA_G002_Sankey
EBIT',
-R_BHP_L_GCO_001_PCA_G002_Sankey
Fixed Costs Sales - POS'-R_BHP_L_GCO_001_PCA_G002_Sankey
Fixed Costs Sales without POS',
-R_BHP_L_GCO_001_PCA_G002_Sankey
Marketing Costs - POS'-R_BHP_L_GCO_001_PCA_G002_Sankey
Marketing Costs without POS'),
color = c("rgba(200,200,200,1)",
"rgba(200,200,200,0.2)",
"rgba(200,200,200,1)",
"rgba(200,200,200,0.2)",
"rgba(200,200,200,0.2)",
"rgba(200,200,200,0.2)",
"rgba(200,200,200,1)",
"rgba(200,200,200,0.2)",
"rgba(200,200,200,0.2)",
"rgba(200,200,200,0.2)")
)
)