{
	"version": 1,
	"header_image": "",
	"allow_edit": false,
	"plugins": [],
	"panes": [
		{
			"width": 1,
			"row": {
				"1": 1,
				"2": 1,
				"3": 1,
				"4": 1,
				"5": 1,
				"6": 1
			},
			"col": {
				"1": 1,
				"2": 1,
				"3": 1,
				"4": 1,
				"5": 1,
				"6": 1
			},
			"col_width": 6,
			"widgets": [
				{
					"type": "html",
					"settings": {
						"html": "let clock = datasources[\"Clock\"][\"numeric_value\"]; // trick to trigger the update\nlet cols = document.getElementsByClassName('gs_w')[0].getAttribute('data-sizex');\ndocument.getElementsByClassName('gs_w')[0].firstElementChild.firstElementChild.innerHTML = \"\";\n\nvar title = \"\";\nif (datasources[\"gwhealth\"][\"gwstatus\"] == \"OK\") {\n\ttitle = \"Public Operations Screen\"; // Change this title. Try not to exceed the 30 chars\n}\nif (datasources[\"gwhealth\"][\"gwstatus\"] == \"KO\") {\n\ttitle = \"Public Operations Screen [Offline]\"; // Change this title. Try not to exceed the 30 chars\n}\n\nlet fontsize = Math.round((-0.66486486*title.length+66.67567568)*cols/4);\nlet lmargin = Math.round((0.43918919*title.length-4.05405405)+3.75*cols*cols-34.75*cols+79.75);\nlet width = 100-lmargin;\n\nvar text = `<div style=\\\"position: relative; margin-top: -15px; text-align: left;\\\">\n\t\t\t<div style=\\\"position: relative;\\\">\n\t\t\t\t<img src=\\\"../img/ess-logo.svg\\\" title=\\\"Designed by Emanuele Laface with p4p and Freeboard. Graphics by Dirk Nordt.\\\"></img>\n\t\t\t</div>\n<div class=\\\"tw-value\\\" style=\\\"font-size: `+String(fontsize)+`px; color:#ffffff !important; position: absolute; left: `+String(lmargin)+`%; width: `+String(width)+`%; height: 100%; justify-content: center; display: flex; align-items: center;\\\" title=\\\"Designed by Emanuele Laface with p4p and Freeboard. Graphics by Dirk Nordt.\\\">\n\t\t\t\t`+title+`\n\t\t\t</div>\n\t\t</div>`;\n\nif (cols == 1){\n    text = \"<div style=\\\"position: static; margin-top: -15px;\\\"><img src=\\\"../img/ess-logo.svg\\\" title=\\\"Designed by Emanuele Laface with p4p and Freeboard. Graphics by Dirk Nordt.\\\"><div class=\\\"tw-value\\\" style=\\\"font-size: 30px; color:#ffffff !important; position: relative; bottom: 55px; left: 30px;\\\" title=\\\"Designed by Emanuele Laface with p4p and Freeboard. Graphics by Dirk Nordt.\\\"></div></img></div>\";\n    document.getElementsByClassName('gs_w')[0].firstElementChild.firstElementChild.innerHTML = title;\n}\n\nreturn text;",
						"height": 2
					}
				}
			]
		},
		{
			"width": 1,
			"row": {
				"1": 7,
				"2": 7,
				"3": 7,
				"4": 7,
				"5": 7,
				"7": 7
			},
			"col": {
				"1": 1,
				"2": 1,
				"3": 1,
				"4": 1,
				"5": 1,
				"7": 1
			},
			"col_width": 5,
			"widgets": [
				{
					"type": "html",
					"settings": {
						"html": "let clock = datasources[\"Clock\"][\"numeric_value\"]; // trick to trigger the update\nlet cols = document.getElementsByClassName('gs_w')[0].getAttribute('data-sizex');\ndocument.getElementsByClassName('gs_w')[0].firstElementChild.firstElementChild.innerHTML = \"\";\n\nif (cols == 5) {\n\ttext = \"<center><H1>Spoke 06 Coupler 1 Warm Conditioningn</H1></center>\"\n}\nif (cols == 4) {\n\ttext = \"<center><H1>Spoke 06 Coupler 1 Warm Conditioningn</H1></center>\"\n}\nif (cols == 3) {\n\ttext = \"<center><H1>Spoke 06 Coupler 1 Warm Conditioningn</H1></center>\"\n}\nif (cols == 2) {\n\ttext = \"<center><H3>Spoke 06 Coupler 1 Warm Conditioningn</H3></center>\"\n}\nif (cols == 1) {\n\ttext = \"<center><H4>Spoke 06 Coupler 1 Warm Conditioningn</H4></center>\"\n}\n\nreturn text;",
						"height": 1
					}
				}
			]
		},
		{
			"title": "Power",
			"width": 1,
			"row": {
				"1": 23,
				"2": 23,
				"3": 23,
				"4": 11,
				"5": 23,
				"13": 23
			},
			"col": {
				"1": 1,
				"2": 1,
				"3": 1,
				"4": 1,
				"5": 1,
				"13": 1
			},
			"col_width": 5,
			"widgets": [
				{
					"type": "flot_extended_plugin",
					"settings": {
						"plot_type": "line",
						"legend": true,
						"height": 5,
						"value": "function shiftTime(dataset) {\n  return dataset.map(splitted => {\n    let x = splitted[0]+7200000;\n    let y = splitted[1];\n\n    return [x, y];\n  });\n}\n\ndata = [{label: 'Spk-060RFC:RFS-LLRF-101:FFPulseGenP', data: shiftTime(datasources[\"archiver\"][\"Spk-060RFC:RFS-LLRF-101:FFPulseGenP\"])}];\nreturn data;\n",
						"xticks": "",
						"yticks": "datasources[\"Clock\"][\"numeric_value\"];\n\nvar ytick = [];\n\nlet valuesy = datasources[\"archiver\"][\"Spk-060RFC:RFS-LLRF-101:FFPulseGenP\"].map(ylist => ylist[1]);\n\nlet maxy = Math.max(...valuesy);\nlet miny = Math.min(...valuesy);\n\nfor (i = miny; i < maxy; i += (maxy-miny)/8) {\n\tytick.push([i, String(i.toFixed(0))]);\n}\n\nytick.push([maxy, \"Power [kW]\"]);\n\nreturn ytick;",
						"x_timestamp": true,
						"zoom": ""
					}
				}
			]
		},
		{
			"title": "Vacuum",
			"width": 1,
			"row": {
				"1": 11,
				"2": 11,
				"3": 11,
				"4": 23,
				"5": 11,
				"6": 17,
				"9": 17,
				"11": 17,
				"17": 17
			},
			"col": {
				"1": 1,
				"2": 1,
				"3": 1,
				"4": 1,
				"5": 1,
				"6": 1,
				"9": 1,
				"11": 1,
				"17": 1
			},
			"col_width": 6,
			"widgets": [
				{
					"type": "flot_extended_plugin",
					"settings": {
						"plot_type": "line",
						"legend": true,
						"height": 5,
						"value": "function shiftTime(dataset) {\n  return dataset.map(splitted => {\n    let x = splitted[0]+7200000;\n    let y = splitted[1];\n\n    return [x, y];\n  });\n}\n\n\ndata = [{label: 'Spk-060Crm:Vac-VGC-10000:PrsR', data: shiftTime(datasources[\"archiver\"][\"Spk-060Crm:Vac-VGC-10000:PrsR\"])}];\nreturn data;\n\n\n",
						"xticks": "",
						"yticks": "datasources[\"Clock\"][\"numeric_value\"];\n\nvar ytick = [];\n\nlet valuesy = datasources[\"archiver\"][\"Spk-060Crm:Vac-VGC-10000:PrsR\"].map(ylist => ylist[1]);\n\nlet maxy = Math.max(...valuesy);\nlet miny = Math.min(...valuesy);\n\nfor (i = miny; i < maxy; i += (maxy-miny)/8) {\n\tytick.push([i, String((i*1e9).toFixed(0))]);\n}\n\nytick.push([maxy, \"x10⁻⁹ [mBar]\"]);\n\nreturn ytick;",
						"x_timestamp": true,
						"points": false,
						"zoom": "xy"
					}
				}
			]
		},
		{
			"title": "LLRF Klystron Output",
			"width": 1,
			"row": {
				"1": 35,
				"2": 35,
				"3": 35,
				"4": 35,
				"5": 35,
				"22": 35
			},
			"col": {
				"1": 1,
				"2": 1,
				"3": 1,
				"4": 1,
				"5": 1,
				"22": 1
			},
			"col_width": 5,
			"widgets": [
				{
					"type": "flot_extended_plugin",
					"settings": {
						"plot_type": "line",
						"legend": true,
						"height": 5,
						"value": "let pwrxdata = datasources[\"general\"][\"Spk-060RFC:RFS-DIG-101:Dwn3-XAxis.[0:100:-1]\"][\"value\"];\nlet pwrydata = datasources[\"general\"][\"Spk-060RFC:RFS-DIG-101:Dwn3-Cmp0.[0:100:-1]\"][\"value\"];\nvar pwrdata = [];\n\nfor (i=0; i < pwrxdata.length; i++) {\n\tpwrdata.push([pwrxdata[i], pwrydata[i]]);\n}\n\nlet data = [{label: 'LLRF Power', data: pwrdata}];\n\nreturn data;",
						"xticks": "datasources[\"Clock\"][\"numeric_value\"];\nlet cols = document.getElementsByClassName('gs_w')[0].getAttribute('data-sizex');\n\nvar xtick = [];\n\nlet valuesx = datasources[\"general\"][\"Spk-060RFC:RFS-DIG-101:Dwn3-XAxis.[0:100:-1]\"][\"value\"];\n\nlet maxx = Math.max(...valuesx);\nlet minx = Math.min(...valuesx);\n\nvar values = 14;\nif (cols == 1) {\n    values = 6;\n}\n\nfor (i = minx; i < maxx; i += (maxx-minx)/values) {\n\txtick.push([i, String(i.toFixed(2))]);\n}\n\nxtick[Math.floor(xtick.length/2)]=[xtick[Math.floor(xtick.length/2)][0], xtick[Math.floor(xtick.length/2)][1]+\"<br>[ms]\"];\n\nreturn xtick;",
						"yticks": "datasources[\"Clock\"][\"numeric_value\"];\n\nvar ytick = [];\n\nlet valuesy = datasources[\"general\"][\"Spk-060RFC:RFS-DIG-101:Dwn3-Cmp0.[0:100:-1]\"][\"value\"];\n\nlet maxy = Math.max(...valuesy);\nlet miny = Math.min(...valuesy);\n\nfor (i = miny; i < maxy; i += (maxy-miny)/8) {\n\tytick.push([i, String(i.toFixed(0))]);\n}\n\nytick.push([maxy, \"[kW]\"]);\n\nreturn ytick;",
						"x_timestamp": false,
						"zoom": ""
					}
				}
			]
		}
	],
	"datasources": [
		{
			"name": "general",
			"type": "JSON",
			"settings": {
				"url": "/data/api/v2/pvget/Spk-060RFC:RFS-DIG-101:Dwn3-Cmp0.[0:100:-1],Spk-060RFC:RFS-DIG-101:Dwn3-XAxis.[0:100:-1]",
				"use_thingproxy": false,
				"refresh": 10,
				"method": "GET"
			}
		},
		{
			"name": "Clock",
			"type": "clock",
			"settings": {
				"refresh": 1,
				"name": "Clock"
			}
		},
		{
			"name": "gwhealth",
			"type": "JSON",
			"settings": {
				"url": "/data/-/gwhealth/NSO:Ops:SID",
				"use_thingproxy": true,
				"refresh": 10,
				"method": "GET"
			}
		},
		{
			"name": "archiver",
			"type": "JSON",
			"settings": {
				"url": "/data/api/v1/archiver/Spk-060Crm:Vac-VGC-10000:PrsR,Spk-060RFC:RFS-LLRF-101:FFPulseGenP/3600/100/freeboard",
				"use_thingproxy": true,
				"refresh": 10,
				"method": "GET",
				"name": "archiver"
			}
		}
	],
	"columns": 6
}