Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Charge level regression line #4187

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions grafana/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ ENV GF_ANALYTICS_REPORTING_ENABLED=false \
GF_USERS_ALLOW_SIGN_UP=false \
GF_USERS_DEFAULT_LANGUAGE=detect \
GF_DATE_FORMATS_USE_BROWSER_LOCALE=true \
GF_FEATURE_TOGGLES_ENABLE=regressionTransformation \
DATABASE_PORT=5432 \
DATABASE_SSL_MODE=disable

Expand Down
53 changes: 50 additions & 3 deletions grafana/dashboards/charge-level.json
Original file line number Diff line number Diff line change
Expand Up @@ -171,12 +171,13 @@
"type": "grafana-postgresql-datasource",
"uid": "TeslaMate"
},
"editorMode": "code",
"format": "time_series",
"group": [],
"hide": false,
"metricColumn": "none",
"rawQuery": true,
"rawSql": "SELECT\n\t$__time(date),\n\tbattery_level AS \"Battery Level\",\n\tusable_battery_level AS \"Usable Battery Level\"\nfrom positions\n\tWHERE $__timeFilter(date) AND car_id = $car_id\n\tORDER BY Time ASC\n;",
"rawSql": "SELECT\n\tdate_bin(($__interval_ms / 1000 || ' milliseconds')::INTERVAL, date, TIMESTAMP '2003-07-01') as time,\n\tavg(battery_level) AS \"Battery Level\",\n\tavg(usable_battery_level) AS \"Usable Battery Level\"\nfrom positions\n\tWHERE $__timeFilter(date) AND car_id = $car_id\n\tGROUP BY time\n\tORDER BY time ASC\n;",
"refId": "A",
"select": [
[
Expand All @@ -188,6 +189,23 @@
}
]
],
"sql": {
"columns": [
{
"parameters": [],
"type": "function"
}
],
"groupBy": [
{
"property": {
"type": "string"
},
"type": "groupBy"
}
],
"limit": 50
},
"timeColumn": "time",
"where": [
{
Expand Down Expand Up @@ -258,6 +276,35 @@
}
]
}
},
{
"id": "regression",
"options": {
"degree": 5,
"modelType": "polynomial",
"predictionCount": 1000,
"xFieldName": "Time",
"yFieldName": "Battery Level"
}
},
{
"id": "joinByField",
"options": {
"mode": "outer"
}
},
{
"id": "organize",
"options": {
"excludeByName": {
"Battery Level predicted polynomial regression": false
},
"includeByName": {},
"indexByName": {},
"renameByName": {
"Battery Level predicted polynomial regression": "Regression Line"
}
}
}
],
"type": "timeseries"
Expand Down Expand Up @@ -319,7 +366,7 @@
]
},
"time": {
"from": "now-7d",
"from": "now-6M",
"to": "now"
},
"timepicker": {
Expand Down Expand Up @@ -350,6 +397,6 @@
"timezone": "",
"title": "Charge Level",
"uid": "WopVO_mgz",
"version": 5,
"version": 8,
"weekStart": ""
}
Loading