这听起来可能更复杂,至少对于 Grafana。
我有一个实验,其中每个位置 (1-100) 的值都会随时间变化。我想用折线图(或条形图)来显示这一点,其中 x 轴对应于位置 (1-100),y 轴对应于该位置在 Grafana 中设置的时间间隔的平均值在右上角。数据来自数据库。请建议我,我应该在 Grafana 中选择哪种类型的图表(仪表板)来实现目标。我只能看到两种,一种是 x 轴上的时间,另一种是直方图类型,但似乎都不适用。
答案 0 :(得分:0)
我们已经使用 natel-plotly-panel 插件实现了图表。
"panels": [
{
"pconfig": {
"traces": [
{
"mapping": {
"color": "64",
"size": null,
"text": "metriccat",
"x": "loccat",
"y": "valuecat",
"z": null
},
"name": "My value",
"show": {
"line": true,
"lines": true,
"markers": false
}
},
...
]
},
"pluginVersion": "7.5.5",
"targets": [
{
"format": "table",
"group": [],
"metricColumn": "none",
"rawQuery": true,
"rawSql": "SELECT\n avg(column_with_values) AS valuecat,\n loc loccat,\n avg(column_with_values) as metriccat\nFROM ... \nWHERE\n $__timeFilter(timestamp)\nGROUP BY loc\n\n",
"select": [
[
{
"params": [
"value"
],
"type": "column"
}
]
],
"timeColumn": "time",
"where": [
{
"name": "$__timeFilter",
"params": [],
"type": "macro"
}
]
},
...
],
"title": "Average Values Along the Locations",
"type": "natel-plotly-panel",
"version": 1
}
]