![](/img/trans.png)
[英]Deneb plot (Vega-Lite) for Power BI: How to use an free scale y-axis with facet
[英]Deneb plot (Vega-Lite) for Power BI: How to get a hierarchical display of labels on each axis?
我正在使用 Power BI 中的 Deneb 自定义视觉对象构建一个甘特式任务图表,按项目随时间细分。
最终,我的计划是根据我的目的自定义它,其方式 go 超出 Power BI 视觉市场当前提供的甘特图的功能。
为此目的,一个非常简化的模拟数据集看起来像(粘贴在这里):
使用以下 Vega-lite JSON,我可以获得一个不错的起点:
{
"data": {"name": "dataset"},
"layer": [
{
"title" : "Integrated Schedule",
"mark": {
"type": "bar",
"cornerRadius": 5
},
"encoding": {
"x": {
"field": "Start Date",
"type": "temporal",
"timeUnit": "year",
"title" : "Year",
"axis" : {"orient" : "top"}
},
"y": {
"field": "Task ID",
"type": "ordinal",
"scale": { "paddingInner": 0.4, "paddingOuter": 0.4 },
"sort": {
"field": "Project"
},
"title": null,
"axis": {"labels": true}
},
"x2": {"field": "End Date"},
"color": {
"field": "Project"}
}
},
{
"mark": {
"type": "text",
"align": "left",
"baseline": "middle",
"fill": "white",
"dx": 3
},
"encoding": {
"text": {"field": "Task Name", "type": "ordinal"},
"x": {
"field": "Start Date",
"type": "temporal",
"timeUnit": "year",
"title" : "Year"
},
"y": {
"field": "Task ID",
"type": "ordinal",
"title": null,
"axis": {"labels": true}
}
}}
]
}
接下来我想做的是在 X(时间)轴和 Y(项目/任务)轴上显示一些额外的标签。 除了日历年之外,我还想按季度显示明细。 该轴的示例如下所示:
我不确定如何实现这一点,可以使用方面来实现吗?
同样,在带有 Y 轴的 plot 的左侧,由于我按项目对任务进行分组,因此我想从任务 ID 开始显示项目名称。 这似乎使用方面更直接地实现,但是当我尝试这样做时,Deneb 不会解析任何对“行”属性的使用。
关于如何处理这个问题的任何想法?
这很容易做到。 有关条件轴属性和多线轴 Label,请参见此处的示例:
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.