李伟坚老师最近在Easyshu更新了大量的vega图表,Power BI 也支持Vega/Vega lite(使用Deneb视觉对象),我从李老师那里抄了一个玫瑰图到Power BI:
玫瑰图(Rose Chart),也称为极坐标柱状图、南丁格尔玫瑰图,是一种将数据以极坐标形式展示的圆形统计图表。它通过扇形的半径或角度来反映数值大小,形似花瓣,因此得名“玫瑰图”。
Deneb视觉对象拖拽模型中的维度和度量:
点击视觉对象上的...-编辑-空白vega-lite,粘贴以下代码,即可复刻:
{
"data": {"name": "dataset"},
"transform": [
{
"calculate": "datum.城市 + ' ' + format(datum.KPI__highlight, '.1f')",
"as": "label"
}
],
"layer": [
{
"mark": {
"type": "arc",
"innerRadius": 20,
"outerRadius": 100,
"cornerRadius": 0,
"stroke": "#fff",
"tooltip": true
},
"encoding": {
"theta": {
"field": "KPI__highlight",
"type": "quantitative",
"stack": true
},
"radius": {
"field": "KPI__highlight",
"scale": {"type": "sqrt", "zero": true}
},
"color": {
"field": "城市",
"type": "nominal",
"legend": null,
"sort": {"field": "KPI__highlight", "order": "descending"}
},
"order": {
"field": "KPI__highlight",
"sort": "descending"
},
"opacity": {
"condition": {
"test": {"field": "__selected__", "equal": "off"},
"value": 0.3
},
"value": 1
}
}
},
{
"mark": {
"type": "text",
"radiusOffset": 50,
"size": 14,
"color": "#333"
},
"encoding": {
"theta": {
"field": "KPI__highlight",
"type": "quantitative",
"stack": true
},
"radius": {
"field": "KPI__highlight",
"scale": {"type": "sqrt", "zero": true}
},
"text": {"field": "label", "type": "nominal"},
"order": {
"field": "KPI__highlight",
"sort": "descending"
}
}
}
],
"view": {"stroke": null},
"config": {
"view": {"stroke": "transparent"},
"text": {
"baseline": "middle",
"align": "center"
}
}
}
可以略微修改中间加上总体值:
扫码关注腾讯云开发者
领取腾讯云代金券
Copyright © 2013 - 2025 Tencent Cloud. All Rights Reserved. 腾讯云 版权所有
深圳市腾讯计算机系统有限公司 ICP备案/许可证号:粤B2-20090059 深公网安备号 44030502008569
腾讯云计算(北京)有限责任公司 京ICP证150476号 | 京ICP备11018762号 | 京公网安备号11010802020287
Copyright © 2013 - 2025 Tencent Cloud.
All Rights Reserved. 腾讯云 版权所有