I have code for stacked bar chart, got from Using Vega Lite to display already-aggregated data it works in vega editor
{
"data": {
"values": [
{"bin": "[-inf,8.0)", "bad_distr": 0.009210526315789473, "good_distr": 0.07763157894736843},
{"bin": "[8.0,14.0)", "bad_distr": 0.075, "good_distr": 0.21842105263157896},
{"bin": "[14.0,16.0)", "bad_distr": 0.009210526315789473, "good_distr": 0.05394736842105263},
{"bin": "[16.0,44.0)", "bad_distr": 0.16052631578947368, "good_distr": 0.3236842105263158},
{"bin": "[44.0,inf)", "bad_distr": 0.04078947368421053, "good_distr": 0.031578947368421054}
]
},
"transform": [
{"fold": ["bad_distr", "good_distr"], "as": ["bad", "good"]}
],
"mark": {"type": "bar"},
"encoding": {
"y": {"type": "ordinal", "field": "bin"},
"x": {"type": "quantitative", "field": "good"},
"color": {"type": "nominal", "field": "bad"}
}
}
Plot comes out good
Same data, I have in elastic database,
same code is throwing warning and plot not coming up
{
"$schema": "https://vega.github.io/schema/vega-lite/v2.4.json",
"title": {
"text": "Bin Plot",
"fontSize":14
},
"data": {
"url" : {
"index": "scorecard_bin_plot",
"body": {
"size":10000,
"_source": ["bin","good_distr","bad_distr"]
}
}
"format": {"property": "hits.hits"},
},
"transform": [
{"fold": ["_source.bad_distr", "_source.good_distr"], "as": ["bad", "good"]}
],
"mark": {"type": "bar"},
"encoding": {
"y": {"type": "ordinal", "field": "_source.bin"},
"x": {"type": "quantitative", "field": "good"},
"color": {"type": "nominal", "field": "bad"}
}
}
I don't understand the issue
Using elastic and kibana 7.12.0