Thank you for reply.
I use Grafana Version 8.0.3.
I made a dashboard for question.
There are two panels. One is Graph(old), and another one is Time series.
The data source is PostgreSQL.
Columns are:
And dashboard JSON is:
{
“annotations”: {
“list”: [
{
“builtIn”: 1,
“datasource”: “-- Grafana --”,
“enable”: true,
“hide”: true,
“iconColor”: “rgba(0, 211, 255, 1)”,
“name”: “Annotations & Alerts”,
“type”: “dashboard”
},
{
“datasource”: null,
“enable”: true,
“iconColor”: “red”,
“name”: “NG detected”,
“rawQuery”: “SELECT\n extract(epoch from inspected_at) AS time,\n CASE WHEN img_url IS NULL\n THEN ‘No file’ \n ELSE concat(‘<a href=’, img_url, ’ target="_blank">画像表示’ )\n END AS text,\n to_char(judge,‘999’) as tags\nFROM\n tbl_inspect_his_img\nWHERE\n judge <> 0 and $__timeFilter(inspected_at)\n”
}
]
},
“editable”: true,
“gnetId”: null,
“graphTooltip”: 0,
“id”: 2,
“links”: ,
“panels”: [
{
“aliasColors”: {},
“bars”: false,
“dashLength”: 10,
“dashes”: false,
“datasource”: “PostgreSQL-wire”,
“fieldConfig”: {
“defaults”: {
“unit”: “short”
},
“overrides”:
},
“fill”: 1,
“fillGradient”: 0,
“gridPos”: {
“h”: 5,
“w”: 24,
“x”: 0,
“y”: 0
},
“hiddenSeries”: false,
“id”: 4,
“legend”: {
“avg”: false,
“current”: false,
“max”: false,
“min”: false,
“show”: true,
“total”: false,
“values”: false
},
“lines”: true,
“linewidth”: 1,
“nullPointMode”: “null”,
“options”: {
“alertThreshold”: true
},
“percentage”: false,
“pluginVersion”: “8.0.3”,
“pointradius”: 2,
“points”: false,
“renderer”: “flot”,
“seriesOverrides”: ,
“spaceLength”: 10,
“stack”: false,
“steppedLine”: false,
“targets”: [
{
“format”: “time_series”,
“group”: [
{
“params”: [
“$__interval”,
“0”
],
“type”: “time”
}
],
“metricColumn”: “none”,
“rawQuery”: false,
“rawSql”: “SELECT\n $__timeGroupAlias(inspected_at,$__interval,0),\n count(id_inspect) AS "id_inspect"\nFROM tbl_inspect_his_img\nWHERE\n $__timeFilter(inspected_at)\nGROUP BY 1\nORDER BY 1”,
“refId”: “A”,
“select”: [
[
{
“params”: [
“id_inspect”
],
“type”: “column”
},
{
“params”: [
“count”
],
“type”: “aggregate”
},
{
“params”: [
“id_inspect”
],
“type”: “alias”
}
]
],
“table”: “tbl_inspect_his_img”,
“timeColumn”: “inspected_at”,
“timeColumnType”: “timestamp”,
“where”: [
{
“name”: “$__timeFilter”,
“params”: ,
“type”: “macro”
}
]
}
],
“thresholds”: ,
“timeFrom”: null,
“timeRegions”: ,
“timeShift”: null,
“title”: “Inspection history(Graph(old) version)”,
“tooltip”: {
“shared”: true,
“sort”: 0,
“value_type”: “individual”
},
“type”: “graph”,
“xaxis”: {
“buckets”: null,
“mode”: “time”,
“name”: null,
“show”: true,
“values”:
},
“yaxes”: [
{
“$$hashKey”: “object:2311”,
“format”: “short”,
“label”: null,
“logBase”: 1,
“max”: null,
“min”: null,
“show”: true
},
{
“$$hashKey”: “object:2312”,
“format”: “short”,
“label”: null,
“logBase”: 1,
“max”: null,
“min”: null,
“show”: true
}
],
“yaxis”: {
“align”: false,
“alignLevel”: null
}
},
{
“datasource”: “PostgreSQL-wire”,
“fieldConfig”: {
“defaults”: {
“color”: {
“mode”: “palette-classic”
},
“custom”: {
“axisLabel”: “”,
“axisPlacement”: “auto”,
“barAlignment”: 0,
“drawStyle”: “line”,
“fillOpacity”: 10,
“gradientMode”: “none”,
“hideFrom”: {
“legend”: false,
“tooltip”: false,
“viz”: false
},
“lineInterpolation”: “linear”,
“lineWidth”: 1,
“pointSize”: 5,
“scaleDistribution”: {
“type”: “linear”
},
“showPoints”: “never”,
“spanNulls”: true,
“stacking”: {
“group”: “A”,
“mode”: “none”
},
“thresholdsStyle”: {
“mode”: “off”
}
},
“mappings”: ,
“thresholds”: {
“mode”: “absolute”,
“steps”: [
{
“color”: “green”,
“value”: null
},
{
“color”: “red”,
“value”: 80
}
]
},
“unit”: “short”
},
“overrides”:
},
“gridPos”: {
“h”: 5,
“w”: 24,
“x”: 0,
“y”: 5
},
“id”: 5,
“options”: {
“legend”: {
“calcs”: ,
“displayMode”: “list”,
“placement”: “bottom”
},
“tooltip”: {
“mode”: “single”
}
},
“pluginVersion”: “8.0.3”,
“targets”: [
{
“format”: “time_series”,
“group”: [
{
“params”: [
“$__interval”,
“0”
],
“type”: “time”
}
],
“metricColumn”: “none”,
“rawQuery”: false,
“rawSql”: “SELECT\n $__timeGroupAlias(inspected_at,$__interval,0),\n count(id_inspect) AS "id_inspect"\nFROM tbl_inspect_his_img\nWHERE\n $__timeFilter(inspected_at)\nGROUP BY 1\nORDER BY 1”,
“refId”: “A”,
“select”: [
[
{
“params”: [
“id_inspect”
],
“type”: “column”
},
{
“params”: [
“count”
],
“type”: “aggregate”
},
{
“params”: [
“id_inspect”
],
“type”: “alias”
}
]
],
“table”: “tbl_inspect_his_img”,
“timeColumn”: “inspected_at”,
“timeColumnType”: “timestamp”,
“where”: [
{
“name”: “$__timeFilter”,
“params”: ,
“type”: “macro”
}
]
}
],
“timeFrom”: null,
“timeShift”: null,
“title”: “Inspection history(Time series version)”,
“type”: “timeseries”
}
],
“refresh”: false,
“schemaVersion”: 30,
“style”: “dark”,
“tags”: ,
“templating”: {
“list”:
},
“time”: {
“from”: “2020-07-02T01:12:25.254Z”,
“to”: “2020-07-02T11:46:50.017Z”
},
“timepicker”: {},
“timezone”: “”,
“title”: “test01”,
“uid”: “3mce8tknk”,
“version”: 5
}