From b7cffb282c3748457a9668c1bc6a1bfa0601957f Mon Sep 17 00:00:00 2001
From: Emanuele Laface <emanuele.laface@esss.se>
Date: Thu, 20 Apr 2023 18:20:58 +0200
Subject: [PATCH] Fix source

---
 WebSites/pos/dashboard.json | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/WebSites/pos/dashboard.json b/WebSites/pos/dashboard.json
index 28583bc..c21bd64 100644
--- a/WebSites/pos/dashboard.json
+++ b/WebSites/pos/dashboard.json
@@ -159,6 +159,16 @@
 						"on_text": "String(datasources[\"source\"][\"ISrc-CS:ISS-HVPS-01:Vol-R\"][\"value\"].toFixed(0))+\" \"+datasources[\"source\"][\"ISrc-CS:ISS-HVPS-01:Vol-R\"][\"display\"][\"units\"]",
 						"off_text": "String(datasources[\"source\"][\"ISrc-CS:ISS-HVPS-01:Vol-R\"][\"value\"].toFixed(0))+\" \"+datasources[\"source\"][\"ISrc-CS:ISS-HVPS-01:Vol-R\"][\"display\"][\"units\"]"
 					}
+				},
+				{
+					"type": "text_widget",
+					"settings": {
+						"title": "Beam Current",
+						"size": "regular",
+						"value": "datasources[\"beamcurr\"][\"ISrc-010:PBI-BCM-001:FlatTopCurrentR\"][\"value\"].toFixed(1);",
+						"animate": true,
+						"units": "mA"
+					}
 				}
 			]
 		},
@@ -443,9 +453,9 @@
 						"plot_type": "bar",
 						"legend": true,
 						"height": 6,
-						"value": "let bcmdataset = [[0, Math.max(0,datasources[\"beamcurr\"][\"ISrc-010:PBI-BCM-001:FlatTopCurrentR\"][\"value\"])],\n               [2, Math.max(0,datasources[\"beamcurr\"][\"LEBT-010:PBI-BCM-001:FlatTopCurrentR\"][\"value\"])],\n               [3, Math.max(0,datasources[\"beamcurr\"][\"RFQ-010:PBI-BCM-001:FlatTopCurrentR\"][\"value\"])],\n               [4, Math.max(0,datasources[\"beamcurr\"][\"MEBT-010:PBI-BCM-001:FlatTopCurrentR\"][\"value\"])],\n               [6, Math.max(0,datasources[\"beamcurr\"][\"MEBT-010:PBI-BCM-002:FlatTopCurrentR\"][\"value\"])],\n               [7, Math.max(0,datasources[\"beamcurr\"][\"DTL-010:PBI-BCM-001:FlatTopCurrentR\"][\"value\"])],\n               [8, Math.max(0,datasources[\"beamcurr\"][\"DTL-020:PBI-BCM-001:FlatTopCurrentR\"][\"value\"])],\n               [9, Math.max(0,datasources[\"beamcurr\"][\"DTL-030:PBI-BCM-001:FlatTopCurrentR\"][\"value\"])],\n               [10, Math.max(0,datasources[\"beamcurr\"][\"DTL-040:PBI-BCM-001:FlatTopCurrentR\"][\"value\"])]];\n\nlet fcdataset = [[1, Math.max(0,datasources[\"beamcurr\"][\"LEBT-010:PBI-FC-001:STAT3-MeanValueR\"][\"value\"])],\n               [5, Math.max(0,datasources[\"beamcurr\"][\"MEBT-010:PBI-FC-001:STAT3-MeanValueR\"][\"value\"])],\n               [11, Math.max(0,datasources[\"beamcurr\"][\"DTL-040:PBI-FC-001:STAT3-MeanValueR\"][\"value\"])]];\n\nlet data = [{data: bcmdataset, color: \"lime\"},\n            {data: fcdataset, color: \"yellow\"}];\nreturn data\n",
+						"value": "let bcmdataset = [//[0, Math.max(0,datasources[\"beamcurr\"][\"ISrc-010:PBI-BCM-001:FlatTopCurrentR\"][\"value\"])],\n               [2, Math.max(0,datasources[\"beamcurr\"][\"LEBT-010:PBI-BCM-001:FlatTopCurrentR\"][\"value\"])],\n               [3, Math.max(0,datasources[\"beamcurr\"][\"RFQ-010:PBI-BCM-001:FlatTopCurrentR\"][\"value\"])],\n               [4, Math.max(0,datasources[\"beamcurr\"][\"MEBT-010:PBI-BCM-001:FlatTopCurrentR\"][\"value\"])],\n               [6, Math.max(0,datasources[\"beamcurr\"][\"MEBT-010:PBI-BCM-002:FlatTopCurrentR\"][\"value\"])],\n               [7, Math.max(0,datasources[\"beamcurr\"][\"DTL-010:PBI-BCM-001:FlatTopCurrentR\"][\"value\"])],\n               [8, Math.max(0,datasources[\"beamcurr\"][\"DTL-020:PBI-BCM-001:FlatTopCurrentR\"][\"value\"])],\n               [9, Math.max(0,datasources[\"beamcurr\"][\"DTL-030:PBI-BCM-001:FlatTopCurrentR\"][\"value\"])],\n               [10, Math.max(0,datasources[\"beamcurr\"][\"DTL-040:PBI-BCM-001:FlatTopCurrentR\"][\"value\"])]];\n\nlet fcdataset = [[1, Math.max(0,datasources[\"beamcurr\"][\"LEBT-010:PBI-FC-001:STAT3-MeanValueR\"][\"value\"])],\n               [5, Math.max(0,datasources[\"beamcurr\"][\"MEBT-010:PBI-FC-001:STAT3-MeanValueR\"][\"value\"])],\n               [11, Math.max(0,datasources[\"beamcurr\"][\"DTL-040:PBI-FC-001:STAT3-MeanValueR\"][\"value\"])]];\n\nlet data = [{data: bcmdataset, color: \"lime\"},\n            {data: fcdataset, color: \"yellow\"}];\nreturn data\n",
 						"xticks": "let clock = datasources[\"Clock\"][\"numeric_value\"]; // trick to trigger the update\nlet cols = document.getElementsByClassName('gs_w')[0].getAttribute('data-sizex');\n\nvar xticks = [[0, \"Ion Source<br>BCM\"],\n               [1, \"LEBT<br>FC\"],\n               [2, \"LEBT<br>BCM\"],\n               [3, \"RFQ<br>BCM\"],\n               [4, \"MEBT<br>BCM 1\"],\n               [5, \"MEBT<br>FC\"],\n               [6, \"MEBT<br>BCM 2\"],\n               [7, \"DTL 1<br>BCM\"],\n               [8, \"DTL 2<br>BCM\"],\n               [9, \"DTL 3<br>BCM\"],\n               [10, \"DTL 4<br>BCM\"],\n               [11, \"DTL 4<br>FC\"]];\n\nif (cols == 1) {\n    xticks = [[0, \"ISrc<br>BCM\"],\n               [1, \"<br><br>LEBT<br>FC\"],\n               [2, \"LEBT<br>BCM\"],\n               [3, \"<br><br>RFQ<br>BCM\"],\n               [4, \"MEBT<br>BCM 1\"],\n               [5, \"<br><br>MEBT<br>FC\"],\n               [6, \"MEBT<br>BCM 2\"],\n               [7, \"<br><br>DTL 1<br>BCM\"],\n               [8, \"DTL 2<br>BCM\"],\n               [9, \"<br><br>DTL 3<br>BCM\"],\n               [10, \"DTL 4<br>BCM\"],\n               [11, \"<br><br>DTL 4<br>FC\"]];\n};\n\nif (cols == 2) {\n    xticks = [[0, \"ISrc<br>BCM\"],\n               [1, \"LEBT<br>FC\"],\n               [2, \"LEBT<br>BCM\"],\n               [3, \"RFQ<br>BCM\"],\n               [4, \"MEBT<br>BCM 1\"],\n               [5, \"MEBT<br>FC\"],\n               [6, \"MEBT<br>BCM 2\"],\n               [7, \"DTL 1<br>BCM\"],\n               [8, \"DTL 2<br>BCM\"],\n               [9, \"DTL 3<br>BCM\"],\n               [10, \"DTL 4<br>BCM\"],\n               [11, \"DTL 4<br>FC\"]];\n};\n\nreturn xticks;",
-						"yticks": "let maxcurr = Math.max(datasources[\"beamcurr\"][\"ISrc-010:PBI-BCM-001:FlatTopCurrentR\"][\"value\"],\n         datasources[\"beamcurr\"][\"LEBT-010:PBI-FC-001:STAT3-MeanValueR\"][\"value\"],\n         datasources[\"beamcurr\"][\"LEBT-010:PBI-BCM-001:FlatTopCurrentR\"][\"value\"],\n         datasources[\"beamcurr\"][\"RFQ-010:PBI-BCM-001:FlatTopCurrentR\"][\"value\"],\n         datasources[\"beamcurr\"][\"MEBT-010:PBI-BCM-001:FlatTopCurrentR\"][\"value\"],\n         datasources[\"beamcurr\"][\"MEBT-010:PBI-FC-001:STAT3-MeanValueR\"][\"value\"],\n         datasources[\"beamcurr\"][\"MEBT-010:PBI-BCM-002:FlatTopCurrentR\"][\"value\"],\n         datasources[\"beamcurr\"][\"DTL-010:PBI-BCM-001:FlatTopCurrentR\"][\"value\"],\n         datasources[\"beamcurr\"][\"DTL-020:PBI-BCM-001:FlatTopCurrentR\"][\"value\"],\n         datasources[\"beamcurr\"][\"DTL-030:PBI-BCM-001:FlatTopCurrentR\"][\"value\"],\n         datasources[\"beamcurr\"][\"DTL-040:PBI-BCM-001:FlatTopCurrentR\"][\"value\"],\n         datasources[\"beamcurr\"][\"DTL-040:PBI-FC-001:STAT3-MeanValueR\"][\"value\"],1);\n\n\nlet step=maxcurr/10;\nvar yticks=[];\nfor (i=0; i<=maxcurr+step; i+=step) {\n    yticks.push([i,i.toFixed(1).toString()]);\n}\n\nyticks[yticks.length-1] = [yticks[yticks.length-1][0],\"[mA]\"];\n\nreturn yticks;\n",
+						"yticks": "let maxcurr = Math.max(//datasources[\"beamcurr\"][\"ISrc-010:PBI-BCM-001:FlatTopCurrentR\"][\"value\"],\n         datasources[\"beamcurr\"][\"LEBT-010:PBI-FC-001:STAT3-MeanValueR\"][\"value\"],\n         datasources[\"beamcurr\"][\"LEBT-010:PBI-BCM-001:FlatTopCurrentR\"][\"value\"],\n         datasources[\"beamcurr\"][\"RFQ-010:PBI-BCM-001:FlatTopCurrentR\"][\"value\"],\n         datasources[\"beamcurr\"][\"MEBT-010:PBI-BCM-001:FlatTopCurrentR\"][\"value\"],\n         datasources[\"beamcurr\"][\"MEBT-010:PBI-FC-001:STAT3-MeanValueR\"][\"value\"],\n         datasources[\"beamcurr\"][\"MEBT-010:PBI-BCM-002:FlatTopCurrentR\"][\"value\"],\n         datasources[\"beamcurr\"][\"DTL-010:PBI-BCM-001:FlatTopCurrentR\"][\"value\"],\n         datasources[\"beamcurr\"][\"DTL-020:PBI-BCM-001:FlatTopCurrentR\"][\"value\"],\n         datasources[\"beamcurr\"][\"DTL-030:PBI-BCM-001:FlatTopCurrentR\"][\"value\"],\n         datasources[\"beamcurr\"][\"DTL-040:PBI-BCM-001:FlatTopCurrentR\"][\"value\"],\n         datasources[\"beamcurr\"][\"DTL-040:PBI-FC-001:STAT3-MeanValueR\"][\"value\"],1);\n\n\nlet step=maxcurr/10;\nvar yticks=[];\nfor (i=0; i<=maxcurr+step; i+=step) {\n    yticks.push([i,i.toFixed(1).toString()]);\n}\n\nyticks[yticks.length-1] = [yticks[yticks.length-1][0],\"[mA]\"];\n\nreturn yticks;\n",
 						"points": false,
 						"zoom": "xy"
 					}
-- 
GitLab