在Kibana仪表板中的Vega可视化中的信号元素的显示使用autosize不能完全显示



我想在Kibana中显示Vega,具有自动大小激活,能够在仪表板中调整到任何大小,但我无法让它显示我的信号(无线电类型),而不必使用滚动条。

在这里,我展示了一个示例代码,您可以看到我遇到的问题。在这种情况下,我还没有将信号链接到任何东西,因为我首先需要解决的是它可以很容易地看到,而不需要使用滚动:
{
"$schema": "https://vega.github.io/schema/vega/v5.json",

"data": [
{
"name": "table",
"values": [
{"category": "A", "amount": 28},
{"category": "B", "amount": 55},
{"category": "C", "amount": 43},
{"category": "D", "amount": 91},
{"category": "E", "amount": 81},
{"category": "F", "amount": 53},
{"category": "G", "amount": 19},
{"category": "H", "amount": 87}
]
}
],
"signals": [
{  
"name": "radio_signal", "value": "ALL",
"bind": {"input": "radio", "options": ["ALL", "OK", "NOK"]}
},    
{
"name": "tooltip",
"value": {},
"on": [
{"events": "rect:mouseover", "update": "datum"},
{"events": "rect:mouseout",  "update": "{}"}
]
}

],
"scales": [
{
"name": "xscale",
"type": "band",
"domain": {"data": "table", "field": "category"},
"range": "width",
"padding": 0.05,
"round": true
},
{
"name": "yscale",
"domain": {"data": "table", "field": "amount"},
"nice": true,
"range": "height"
}
],
"axes": [
{
"orient": "bottom",
"scale": "xscale",
"title": "X-Axis",
},
{ "orient": "left", 
"scale": "yscale",
"title": "Y-Axis", 
"tickCount": 4,"offset": 6 }
],
"marks": [
{
"type": "rect",
"from": {"data":"table"},
"encode": {
"enter": {
"x": {"scale": "xscale", "field": "category"},
"width": {"scale": "xscale", "band": 1},
"y": {"scale": "yscale", "field": "amount"},
"y2": {"scale": "yscale", "value": 0}
},
"update": {
"fill": {"value": "steelblue"}
},
"hover": {
"fill": {"value": "red"}
}
}
},
{
"type": "text",
"encode": {
"enter": {
"align": {"value": "center"},
"baseline": {"value": "bottom"},
"fill": {"value": "#333"}
},
"update": {
"x": {"scale": "xscale", "signal": "tooltip.category", "band": 0.5},
"y": {"scale": "yscale", "signal": "tooltip.amount", "offset": -2},
"text": {"signal": "tooltip.amount"},
"fillOpacity": [
{"test": "isNaN(tooltip.amount)", "value": 0},
{"value": 1}
]
}
}
}
]
}

你需要稍微调整heightwidth信号10到20,这取决于你的无线电信号的名称有多长,这将基本上缩小你的可视化稍微。我有过需要减去40的例子,所以稍微调整一下这个值。例如,尝试将此添加到信号规范中…

...
signals: [
...
{
height: height - 10
}
{
width: width -10
}
...
]
...

最新更新