Skip to content

Instantly share code, notes, and snippets.

View BrianInAz's full-sized avatar
😁

Brian Charbonneau BrianInAz

😁
  • Arizona, USA
  • 01:17 (UTC -07:00)
View GitHub Profile
@BrianInAz
BrianInAz / Grafana.scriptable
Created November 8, 2024 07:31 — forked from michaelpayne02/Grafana.scriptable
iOS Grafana widgets using Scriptable and grafana-image-renderer
{
"always_run_in_app" : false,
"icon" : {
"color" : "orange",
"glyph" : "chart-area"
},
"name" : "Grafana",
"script" : "\/\/ Configuration\nconst url = \"http:\/\/grafana.example.com\";\nconst token = \"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\";\nconst orgId = 1;\nconst dashboardName = \"widgets\";\nconst dashboardId = \"xxxxxxxxxxxxxx\";\nconst tz = \"America\/Chicago\";\nconst darkMode = true;\nconst deviceSize = \"393x852\";\n\nparams = config.runsInWidget\n ? args.widgetParameter?.split(\",\") : []\n\nconst opts = {\n type: params[0] ? params[0] : \"md\",\n panel: params[1] ? params[1] : \"1\",\n from: params[2] ? params[2] : \"now-30m\",\n to: params[3] ? params[3] : \"now\",\n title: params[4] ? params[4] : \"Grafana\",\n align: params[5] ? params[5] : \"c\",\n};\n\n\/\/ Scriptable limits displayed image resolution to a max of 500x500\nconst imageSizes = {\n sm: new Size(474, 474),\n md: new Size(500, 210),\n lg: new Size(500, 500),\n re: new Size(480, 216),\n ci: ne