Vega lite 如何在vega lite中过滤数据?
我有一个线图的代码,我不知道如何使用过滤器转换,我有一个层内的标记和编码,以使用绘图的工具提示Vega lite 如何在vega lite中过滤数据?,vega-lite,vega,Vega Lite,Vega,我有一个线图的代码,我不知道如何使用过滤器转换,我有一个层内的标记和编码,以使用绘图的工具提示 { "$schema": "https://vega.github.io/schema/vega-lite/v2.4.json", "title": "Dashboard", "data": { "url" : { "%context%&
{
"$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"
}
],
“转换”:[
{
“筛选”:“datum.Value您似乎没有名为Value
的字段;您有名为\u source.Value
的字段。因此,正确的筛选方法是:
“转换”:[
{
“过滤器”:“基准面”\u源值