Transform / Filter issue in Area chart

Here is part of my "data" section:
"data": [
{
"name": "sp500",
url: {
index: mgpnlquery*
body: {
size: 1000
_source: ["price", "account", "acctype", "region" ]
"query": {
"range" : {
"@timestamp" : {
"gte" : "now-34s",
"lt" : "now"
}
}
}
}
}
"format": { "property": "hits.hits" }
},
{
"name": "noFilter",
"source": "sp500",
"transform": [
{"type": "filter", "expr": "datum.region != null"}
]
},
etc .....

The following works to display the data: ("sp500" is the datastream)
"marks": [
{
"type": "group",
"name": "detail",
"encode": {
"enter": {
"height": {"value": 390},
"width": {"value": 1700}
}
},
"scales": [
{
"name": "xDetail",
"type": "point",
"range": "width",
"domain": {"data": "sp500", "field": "_source.account"}
"domainRaw": {"signal": "detailDomain"}
},
{
"name": "yDetail",
"type": "linear",
"range": [390, 0],
"domain": {"data": "sp500", "field": "_source.price"},
"nice": true, "zero": true
}
],
.. etc

The following does not work ("noFilter" is the datastream) - Am I configuring "noFilter" incorrectly?
"marks": [
{
"type": "group",
"name": "detail",
"encode": {
"enter": {
"height": {"value": 390},
"width": {"value": 1700}
}
},
"scales": [
{
"name": "xDetail",
"type": "point",
"range": "width",
"domain": {"data": "noFilter", "field": "_source.account"}
"domainRaw": {"signal": "detailDomain"}
},
{
"name": "yDetail",
"type": "linear",
"range": [390, 0],
"domain": {"data": "noFilter", "field": "_source.price"},
"nice": true, "zero": true
}
],
.. etc

Problem solved - the correct syntax for the filter:
{
"name": "noFilter",
"source": "sp500",
"transform": [
{"type": "filter", "expr": "datum._source['region'] != null"}
]
},

1 Like

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.