I am getting an vega error Node Not Found XXX i dont know whats going on.
{
"$schema": "https://vega.github.io/schema/vega/v5.json",
"title": "Merchant Transaction Network",
"width": 800,
"height": 600,
"autosize": "none",
"data": [
{
"name": "merchant_transactions",
"url": {
"%context%": true,
"%timefield%": "@timestamp",
"index": "transactions*",
"body": {
"size": 0,
"aggs": {
"merchants": {
"terms": {
"field": "merchant_name.keyword",
"size": 5,
"min_doc_count": 1
},
"aggs": {
"total_amount": {
"sum": {
"field": "transaction_amount"
}
}
}
}
}
}
},
"format": {
"property": "aggregations.merchants.buckets"
}
},
{
"name": "nodes",
"source": "merchant_transactions",
"transform": [
{
"type": "filter",
"expr": "datum.key && datum.key !== ''"
},
{
"type": "formula",
"expr": "datum.key",
"as": "id"
},
{
"type": "formula",
"expr": "abs(datum.total_amount.value) > 0 ? abs(datum.total_amount.value)/10 : 10",
"as": "size"
},
{"type": "identifier", "as": "index"},
{"type": "formula", "as": "index", "expr": "datum['index'] - 1"}
]
},
{
"name": "links",
"source": "merchant_transactions",
"transform": [
{
"type": "filter",
"expr": "datum.key && datum.key !== ''"
},
{
"type": "formula",
"expr": "datum.key",
"as": "source"
},
{
"type": "formula",
"expr": "'Transactions'",
"as": "target"
},
{
"type": "lookup",
"from": "final_nodes",
"key": "id",
"fields": ["source"],
"as": ["source_node"]
},
{
"type": "filter",
"expr": "datum.source_node !== null"
},
{
"type": "formula",
"expr": "datum.total_amount.value > 0 ? datum.total_amount.value : 1",
"as": "value"
}
]
}
],
"marks": [
{
"type": "symbol",
"from": {"data": "final_nodes"},
"encode": {
"enter": {
"size": {"field": "size", "mult": 0.1},
"fill": {"scale": "color", "field": "id"},
"stroke": {"value": "#fff"},
"strokeWidth": {"value": 1.5}
}
},
"transform": [
{
"type": "force",
"iterations": 300,
"restart": true,
"static": false,
"signal": "force",
"forces": [
{"force": "center", "x": {"signal": "width / 2"}, "y": {"signal": "height / 2"}},
{"force": "collide", "radius": 15},
{"force": "link", "links": "links"}
]
}
]
},
{
"type": "path",
"from": {"data": "links"},
"encode": {
"enter": {
"stroke": {"value": "#aaa"},
"strokeWidth": {"value": 1}
}
}
}
],
"scales": [
{
"name": "color",
"type": "ordinal",
"domain": {"data": "final_nodes", "field": "id"},
"range": {"scheme": "category10"}
}
]
}