briangann / grafana-gauge-panel

D3 Based Gauge Panel for Grafana 6.x and Higher
MIT License
57 stars 24 forks source link

The needle shows exactly twice as much as it really is. Where's my mistake? #100

Closed mrmaximas closed 1 year ago

mrmaximas commented 1 year ago

I'm using latest version of plugin. Latest Mac OS on M1 with latest Safari. Grafana 9.5.2 on Catalina from Homebrew. The needle shows exactly twice as much as it really is. Where's my mistake? Or it's a bug? Thank You! Screenshot 2023-11-17 at 15 18 35

Code is:

{ "datasource": { "type": "influxdb", "uid": "dYcM5a-4k" }, "fieldConfig": { "defaults": { "unit": "degree", "decimals": 0, "mappings": [], "thresholds": { "mode": "absolute", "steps": [ { "color": "green", "value": null } ] } }, "overrides": [] }, "gridPos": { "h": 10, "w": 4, "x": 20, "y": 0 }, "id": 20, "links": [], "options": { "operatorName": "last", "valueFont": "Inter", "valueFontSize": 8, "tickFont": "Inter", "tickLabelFontSize": 12, "animateNeedleValueTransition": true, "animateNeedleValueTransitionSpeed": 500, "allowNeedleCrossLimits": false, "needleCrossLimitDegrees": 0, "needleWidth": 3, "markerEndEnabled": true, "markerEndShape": "arrow", "markerStartEnabled": true, "markerStartShape": "circle", "minValue": 0, "maxValue": 360, "outerEdgeColor": "#0f5f7a", "innerColor": "#ffffff", "pivotColor": "#999999", "needleColor": "#0f5f7a", "unitsLabelColor": "#000000", "tickLabelColor": "#000000", "tickMajorColor": "#0f5f7a", "tickMinorColor": "#000000", "gaugeRadius": 0, "ticknessGaugeBasis": 100, "pivotRadius": 0.15, "valueYOffset": -40, "padding": 0, "edgeWidth": 0.1, "tickEdgeGap": 0.1, "tickLengthMaj": 0.2, "tickWidthMajor": 2, "tickLengthMin": 0.1, "tickWidthMinor": 1, "needleTickGap": 0, "needleLengthNeg": 0.2, "zeroTickAngle": 180, "maxTickAngle": 540, "zeroNeedleAngle": 180, "maxNeedleAngle": 540, "tickSpacingMinor": 5, "tickSpacingMajor": 45, "tickMapConfig": { "tickMaps": [ { "enabled": true, "label": "TickMap-0", "order": 0, "text": "N", "value": "0" }, { "enabled": true, "label": "TickMap-1", "order": 1, "text": "E", "value": "90" }, { "enabled": true, "label": "TickMap-2", "order": 2, "text": "S", "value": "180" }, { "enabled": true, "label": "TickMap-3", "order": 3, "text": "W", "value": "270" }, { "enabled": true, "label": "TickMap-4", "order": 4, "text": "NE", "value": "45" }, { "enabled": true, "label": "TickMap-5", "order": 5, "text": "SE", "value": "135" }, { "enabled": true, "label": "TickMap-6", "order": 6, "text": "SW", "value": "225" }, { "enabled": true, "label": "TickMap-7", "order": 7, "text": "NW", "value": "315" } ] }, "showThresholdBandOnGauge": false, "showThresholdBandLowerRange": true, "showThresholdBandMiddleRange": true, "showThresholdBandUpperRange": true, "showThresholdStateOnBackground": false, "showThresholdStateOnValue": false }, "pluginVersion": "2.0.1", "targets": [ { "datasource": { "type": "influxdb", "uid": "dYcM5a-4k" }, "query": "from(bucket: \"IoT\")\n |> range(start: v.timeRangeStart, stop:v.timeRangeStop)\n |> filter(fn: (r) => r[\"_measurement\"] == \"madhome\")\n |> filter(fn: (r) => r[\"_field\"] == \"wind_angle\")\n |> filter(fn: (r) => r[\"deviceId\"] == \"Weather station\")\n |> window(every: 5m)\n\n ", "refId": "A" } ], "type": "briangann-gauge-panel" }

briangann commented 1 year ago

looks like a bug - the value selected is "last" which should just be whatever the last reading is.

i'll try it with a test datasource and see if i can reproduce it.

briangann commented 1 year ago

I tried this with the test datasource and fixed CSV metric values, and it appears to show the correct location.

In the screenshot 84 degrees is near "East" where 90 is exactly "East"

What do you mean by showing "double"?

mrmaximas commented 1 year ago

I'm sorry, not twice, devided by two. if numeric value on the gauge is 84 then the needle shows 42. for example Screenshot 2023-11-18 at 09 54 54 Screenshot 2023-11-18 at 09 53 50 right now with 6h interval.

mrmaximas commented 1 year ago

Screenshot 2023-11-18 at 10 15 18 Screenshot 2023-11-18 at 10 16 00 { "datasource": { "type": "influxdb", "uid": "dYcM5a-4k" }, "fieldConfig": { "defaults": { "unit": "degree", "decimals": 0, "mappings": [], "thresholds": { "mode": "absolute", "steps": [ { "color": "green", "value": null } ] } }, "overrides": [] }, "gridPos": { "h": 10, "w": 4, "x": 20, "y": 0 }, "id": 20, "links": [], "options": { "operatorName": "last", "valueFont": "Inter", "valueFontSize": 8, "tickFont": "Inter", "tickLabelFontSize": 12, "animateNeedleValueTransition": true, "animateNeedleValueTransitionSpeed": 500, "allowNeedleCrossLimits": false, "needleCrossLimitDegrees": 0, "needleWidth": 3, "markerEndEnabled": true, "markerEndShape": "arrow", "markerStartEnabled": true, "markerStartShape": "circle", "minValue": 0, "maxValue": 360, "outerEdgeColor": "#0f5f7a", "innerColor": "#ffffff", "pivotColor": "#999999", "needleColor": "#0f5f7a", "unitsLabelColor": "#000000", "tickLabelColor": "#000000", "tickMajorColor": "#0f5f7a", "tickMinorColor": "#000000", "gaugeRadius": 0, "ticknessGaugeBasis": 100, "pivotRadius": 0.15, "valueYOffset": -40, "padding": 0, "edgeWidth": 0.1, "tickEdgeGap": 0.1, "tickLengthMaj": 0.2, "tickWidthMajor": 2, "tickLengthMin": 0.1, "tickWidthMinor": 1, "needleTickGap": 0, "needleLengthNeg": 0.2, "zeroTickAngle": 180, "maxTickAngle": 540, "zeroNeedleAngle": 180, "maxNeedleAngle": 540, "tickSpacingMinor": 5, "tickSpacingMajor": 45, "tickMapConfig": { "tickMaps": [ { "enabled": true, "label": "TickMap-0", "order": 0, "text": "N", "value": "0" }, { "enabled": true, "label": "TickMap-1", "order": 1, "text": "E", "value": "90" }, { "enabled": true, "label": "TickMap-2", "order": 2, "text": "S", "value": "180" }, { "enabled": true, "label": "TickMap-3", "order": 3, "text": "W", "value": "270" }, { "enabled": true, "label": "TickMap-4", "order": 4, "text": "NE", "value": "45" }, { "enabled": true, "label": "TickMap-5", "order": 5, "text": "SE", "value": "135" }, { "enabled": true, "label": "TickMap-6", "order": 6, "text": "SW", "value": "225" }, { "enabled": true, "label": "TickMap-7", "order": 7, "text": "NW", "value": "315" } ] }, "showThresholdBandOnGauge": false, "showThresholdBandLowerRange": true, "showThresholdBandMiddleRange": true, "showThresholdBandUpperRange": true, "showThresholdStateOnBackground": false, "showThresholdStateOnValue": false }, "pluginVersion": "2.0.1", "targets": [ { "datasource": { "type": "influxdb", "uid": "dYcM5a-4k" }, "query": "from(bucket: \"IoT\")\n |> range(start: v.timeRangeStart, stop:v.timeRangeStop)\n |> filter(fn: (r) => r[\"_measurement\"] == \"madhome\")\n |> filter(fn: (r) => r[\"_field\"] == \"wind_angle\")\n |> filter(fn: (r) => r[\"deviceId\"] == \"Weather station\")\n\n\n ", "refId": "A" } ], "type": "briangann-gauge-panel" }

briangann commented 1 year ago

Not sure how that is divided by 2, the angle (with your panel settings) is relative to North (0).

84 on the dial would be almost East (90, exact right side), that's 90 degrees going clockwise from N (0).

image

mrmaximas commented 1 year ago

I'm so sorry, apparently my weekend started a little earlier than it should have )