gpt4 book ai didi

javascript - 如何从 Vega Lite 图表中删除轴线

转载 作者:行者123 更新时间:2023-12-05 03:26:32 26 4
gpt4 key购买 nike

我想从下面的 vega-lite 图表中删除/隐藏轴线。我已尝试将颜色更改为 null(如下所示)或其他颜色,但这不起作用。

https://vega.github.io/editor/#/gist/fc799bc9f7a8f28b8f1f2ec84673e965/VL带有轴线.json

enter image description here

{
"$schema": "https://vega.github.io/schema/vega-lite/v5.json",
"description": "A simple bar chart with embedded data.",
"data": {
"values": [
{"responseType": "Yes", "proportion": 28},
{"responseType": "No", "proportion": 7}
]
},
"mark": "bar",
"encoding": {
"y": {
"field": "responseType",
"type": "nominal",
"title": null,
"axis": {"axisColor": null, "grid": false, "ticks": false}
},
"x": {
"field": "proportion",
"type": "quantitative",
"title": "% of Responses",
"axis": {"axisWidth": "100", "grid": false, "ticks": false}
}
}
}

最佳答案

domain 隐藏轴线,因此设置 "axis": {"domain": false, "grid": false, "ticks": false} x 和 y 生成此图表:

enter image description here

如果您还添加 "config": {"view": {"stroke": null}} 作为顶级属性,您将摆脱灰色轮廓:

enter image description here

Open the Chart in the Vega Editor

关于javascript - 如何从 Vega Lite 图表中删除轴线,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/71708946/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com