r - 如何在桑基图中永久显示节点上的值?
问题描述
我在 SAP Analytics Cloud 的 R 可视化中使用了代码。目前,这些值仅在悬停在节点上时显示。但是控制人员希望在节点上永久看到这些值。这是我目前的代码:
#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)")
)
)
解决方案
推荐阅读
- vue.js - 如何使用获取的数据更新 Vue 组件的属性
- docker - 为什么当我将 nginx 添加到 docker 时会出现错误:/bin/sh: pip: not found
- jquery - 如何通过模态为所选文本制作超链接
- swift - 如何安全地将 AVKit 与 https 连接?
- javascript - Javascript 二维数组问题
- asp.net - 有没有办法在编译和部署 ASP.Net Web 应用程序后添加模型、数据访问类、Web api 控制器?
- c++ - C ++:使用多种条件验证字符串
- java - 如何从头开始获取线坐标?
- android - 警告:API 'variantOutput.getPackageApplication()' 已过时
- regex - 用于匹配 yyyy-mm-dd 和 mm/dd/yyyy 的正则表达式