admin管理员组文章数量:1027515
Power BI Deneb 玫瑰图
李伟坚老师最近在Easyshu更新了大量的vega图表,Power BI 也支持Vega/Vega lite(使用Deneb视觉对象),我从李老师那里抄了一个玫瑰图到Power BI:
玫瑰图(Rose Chart),也称为极坐标柱状图、南丁格尔玫瑰图,是一种将数据以极坐标形式展示的圆形统计图表。它通过扇形的半径或角度来反映数值大小,形似花瓣,因此得名“玫瑰图”。
Deneb视觉对象拖拽模型中的维度和度量:
点击视觉对象上的...-编辑-空白vega-lite,粘贴以下代码,即可复刻:
代码语言:javascript代码运行次数:0运行复制{
"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"
}
}
}
可以略微修改中间加上总体值:
Power BI Deneb 玫瑰图
李伟坚老师最近在Easyshu更新了大量的vega图表,Power BI 也支持Vega/Vega lite(使用Deneb视觉对象),我从李老师那里抄了一个玫瑰图到Power BI:
玫瑰图(Rose Chart),也称为极坐标柱状图、南丁格尔玫瑰图,是一种将数据以极坐标形式展示的圆形统计图表。它通过扇形的半径或角度来反映数值大小,形似花瓣,因此得名“玫瑰图”。
Deneb视觉对象拖拽模型中的维度和度量:
点击视觉对象上的...-编辑-空白vega-lite,粘贴以下代码,即可复刻:
代码语言:javascript代码运行次数:0运行复制{
"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"
}
}
}
可以略微修改中间加上总体值:
本文标签: Power BI Deneb 玫瑰图
版权声明:本文标题:Power BI Deneb 玫瑰图 内容由热心网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://it.en369.cn/jiaocheng/1747396230a2163226.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论