You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: dashboards/Charging Costs Stats.json
+39-39Lines changed: 39 additions & 39 deletions
Original file line number
Diff line number
Diff line change
@@ -72,7 +72,7 @@
72
72
"fiscalYearStartMonth": 0,
73
73
"graphTooltip": 1,
74
74
"id": null,
75
-
"iteration": 1672676508324,
75
+
"iteration": 1672724648351,
76
76
"links": [
77
77
{
78
78
"icon": "dashboard",
@@ -218,6 +218,10 @@
218
218
"pluginVersion": "8.5.6",
219
219
"targets": [
220
220
{
221
+
"datasource": {
222
+
"type": "postgres",
223
+
"uid": "${DS_TESLAMATE}"
224
+
},
221
225
"format": "table",
222
226
"group": [],
223
227
"metricColumn": "none",
@@ -243,11 +247,7 @@
243
247
"params": [],
244
248
"type": "macro"
245
249
}
246
-
],
247
-
"datasource": {
248
-
"type": "postgres",
249
-
"uid": "${DS_TESLAMATE}"
250
-
}
250
+
]
251
251
}
252
252
],
253
253
"title": "Total charging cost",
@@ -331,11 +331,15 @@
331
331
"pluginVersion": "8.5.6",
332
332
"targets": [
333
333
{
334
-
"format": "time_series",
334
+
"datasource": {
335
+
"type": "postgres",
336
+
"uid": "${DS_TESLAMATE}"
337
+
},
338
+
"format": "table",
335
339
"group": [],
336
340
"metricColumn": "none",
337
341
"rawQuery": true,
338
-
"rawSql": "WITH since as (\n\tSELECT date FROM positions\n\tWHERE car_id = $car_id\n\tORDER BY date ASC\n\tLIMIT 1\n),\nactual AS (\n\tSELECT\n\t\tdate_trunc('day', date)::date AS date,\n\t\tmax(odometer) - min(odometer) AS distance\n\tFROM positions\n\tWHERE car_id = $car_id\n\tGROUP BY 1\n),\nbase_line AS (\n\tSELECT date_trunc('day', dd)::date AS date\n FROM generate_series((select date from since) , now(), '1 day'::interval) dd\n)\nSELECT \n $__time(base_line.date), \n convert_km(COALESCE(distance, 0)::numeric, '$length_unit') as \"distance_$length_unit\"\nFROM base_line\nLEFT JOIN actual ON actual.date = base_line.date\nWHERE $__timeFilter(base_line.date)\nORDER BY 1;",
342
+
"rawSql": "SELECT convert_km((max(odometer) - min(odometer))::numeric, 'km') as \"distance_km\"\nFROM positions\nWHERE car_id = '1' AND date BETWEEN '2022-12-31T23:00:00Z' AND '2023-01-02T19:57:48.6Z'\nORDER BY 1;",
0 commit comments