我有以下代码用于线图,我不确定如何使用过滤器变换,我在图层内有标记和编码以使用工具提示进行绘图
{
"$schema": "https://vega.github.io/schema/vega-lite/v2.4.json",
"title": "Dashboard",
"data": {
"url" : {
"%context%": true,
"index": "paytrans",
"body": {
"size":10000,
"_source": ["Metrics","Value","ModelName"],
}
}
"format": {"property": "hits.hits"},
},
"layer": [
{
"mark": {
"type": "line",
"point": true
},
"encoding": {
"x": {"field": "_source.ModelName",
"type": "ordinal",
"title":"Models"
"axis": {
"labelAngle": 0
}
},
"y": {"field": "_source.Value", "type": "quantitative", "title":"Metric Score"
"scale": { "domain": [0.0, 1.0] }},
"color": {"field": "_source.Metrics", "type": "nominal", "title":"Metrics"},
"tooltip": [
{"field": "_source.Metrics", "type": "nominal", "title":"Metric"},
{"field": "_source.Value", "type": "quantitative", "title":"Value"}
]
}
}
]
}
如果我加
"transform": [
{
"filter": "datum.Value <= 0.5"
}
],
它不起作用,我可以如何过滤值字段
看来您没有名为的字段Value
;您有一个名为的字段_source.Value
。因此,正确的过滤方法是:
"transform": [
{
"filter": "datum._source.Value <= 0.5"
}
],
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句