我目前正在PowerBI中开发一个风险矩阵,我想用Deneb创建这个矩阵。目标是一个允许交叉过滤的3x3矩阵。大卫已经为Vega代码提供了create支持,但是,仍然存在一些PowerBI特定的问题。我目前的进展可以在这里看到:PowerBi文件。
现在我面临以下挑战,我感谢在克服这些挑战方面提供的任何帮助:
和往常一样,我欣赏任何解决方案、暗示或想法。:)
发布于 2022-05-24 19:56:46
好的,按照这些步骤,有一个完全工作和互动的风险矩阵,如下所示。







{
"$schema": "https://vega.github.io/schema/vega-lite/v5.json",
"data": {"name": "dataset"},
"width": 500,
"height": 500,
"encoding": {
"y": {
"field": "Exposure",
"type": "ordinal",
"sort": ["high", "medium", "low"]
},
"x": {
"field": "Damage",
"type": "ordinal",
"sort": ["low", "medium", "high"],
"axis": {"labelAngle": 0}
}
},
"layer": [
{
"encoding": {
"opacity": {
"condition": {
"test": {"field": "__selected__", "equal": "off"},
"value": 0.3
}
}
},
"mark": {
"type": "rect",
"color": {
"expr": "(datum['Exposure'] == 'high' & datum['Damage'] == 'high') || (datum['Exposure'] == 'high' & datum['Damage'] == 'medium') || (datum['Exposure'] == 'medium' & datum['Damage'] == 'high') ? 'red' : (datum['Exposure'] == 'medium' & datum['Damage'] == 'medium') || (datum['Exposure'] == 'high' & datum['Damage'] == 'low') || (datum['Exposure'] == 'low' & datum['Damage'] == 'high') ? 'orange': 'green'"
}
}
},
{
"mark": {
"type": "text",
"fontSize": 16,
"fontWeight": "bold",
"color": "white"
},
"encoding": {"text": {"field": "Risk Count", "type": "quantitative"}}
}
],
"config": {"axis": {"grid": true, "tickBand": "extent"}}
}https://stackoverflow.com/questions/72363343
复制相似问题