【发布时间】:2021-12-27 05:40:49
【问题描述】:
在 Vega-lite 中,我创建了一个带有分箱数据的直方图,是否可以在其上放置一条密度线。从弹性数据库索引中获取数据。
{
"$schema": "https://vega.github.io/schema/vega-lite/v2.6.json",
"data": {
"url" : {
"index": "artefact_data",
"body": {
"size":10000,
"_source": ["bin_start", "bin_end", "count"]
}
}
"format": {"property": "hits.hits"},
},
"mark": "bar",
"encoding": {
"x": {
"field": "_source.bin_start",
"bin": {"binned": true, "step": 2}
},
"x2": {"field": "_source.bin_end"},
"y": {
"field": "_source.count",
"type": "quantitative"
},
"color": {"value": "green"},
"opacity": {"value": 0.6},
"tooltip": [
{"field": "_source.count", "type": "quantitative", "title":"Count"}
]
}
}
- 我们能否在直方图上绘制一条密度线
- X 轴仅在开始时显示值,其他值不显示或隐藏,如何显示轴值(即使在 45 度)
喜欢 示例数据看起来像 (https://vega.github.io/vega-lite/examples/bar_binned_data.html)
【问题讨论】: