具有预分类数据的网格



对于"bin": "binned",我可以使用预分类数据。如何启用网格?在vega- life到vega的转换过程中,我的grid设置被覆盖到false

{ "mark": "bar",
"encoding": {
"x": {
"type": "temporal",
"bin": "binned",
"field": "start",
"axis": {"grid": true}
},
"x2": {"field": "end"},
"y": {"type": "quantitative", "field": "value"}
},
"transform": [
{"calculate": "toDate(datum.day)", "as": "day"},
{"calculate": "timeOffset('hours', datum.day, -12)", "as": "start"},
{"calculate": "timeOffset('hours', datum.day, 12)", "as": "end"}
],
"height": 250,
"width": 800,
"$schema": "https://vega.github.io/schema/vega-lite/v4.json",
"data": {
"values": [
{"day": "2021-01-01T00:00:00", "value": 5},
{"day": "2021-01-02T00:00:00", "value": 4},
{"day": "2021-01-04T00:00:00", "value": 5},
{"day": "2021-01-05T00:00:00", "value": 4},
{"day": "2021-01-09T00:00:00", "value": 1},
{"day": "2021-01-10T00:00:00", "value": 3},
{"day": "2021-01-11T00:00:00", "value": 2},
{"day": "2021-01-12T00:00:00", "value": 3},
{"day": "2021-01-13T00:00:00", "value": 5},
{"day": "2021-01-15T00:00:00", "value": 3}
]
}}

如果没有模式解决方案,可以通过viewapi重新启用网格吗?

这太可怕了。分层垃圾情节与匹配编码和所有标记透明。希望有人有更好的解决办法。

{ "layer": [
{
"mark": "bar",
"encoding": {
"x": {
"type": "temporal",
"bin": "binned",
"field": "start",
"axis": {"grid": true},
"title": "day"
},
"x2": {"field": "end"},
"y": {"type": "quantitative", "field": "value"}
}
},
{
"mark": {"type": "point", "opacity": 0},
"encoding": {
"x": {
"type": "temporal",
"field": "start",
"axis": {"grid": true}
},
"y": {
"field": "value",
"axis": {"grid": true},
"type": "quantitative"}
}
}
],
"transform": [
{"calculate": "toDate(datum.day)", "as": "day"},
{"calculate": "timeOffset('hours', datum.day, -12)", "as": "start"},
{"calculate": "timeOffset('hours', datum.day, 12)", "as": "end"}
],
"height": 250,
"width": 800,
"$schema": "https://vega.github.io/schema/vega-lite/v4.json",
"data": {
"values": [
{"day": "2021-01-01T00:00:00", "value": 5},
{"day": "2021-01-02T00:00:00", "value": 4},
{"day": "2021-01-04T00:00:00", "value": 5},
{"day": "2021-01-05T00:00:00", "value": 4},
{"day": "2021-01-09T00:00:00", "value": 1},
{"day": "2021-01-10T00:00:00", "value": 3},
{"day": "2021-01-11T00:00:00", "value": 2},
{"day": "2021-01-12T00:00:00", "value": 3},
{"day": "2021-01-13T00:00:00", "value": 5},
{"day": "2021-01-15T00:00:00", "value": 3}
]
}
}

这是修复此问题的拉请求。可能不会有什么结果。

  • #7192修复:当("bin":"binned")
  • 时允许轴设置

最新更新