add grafana panel

This commit is contained in:
Ryan Tang 2022-12-26 17:21:27 -05:00
parent 3c49d126ae
commit 4e3e52234e
2 changed files with 43 additions and 21 deletions

View File

@ -275,25 +275,32 @@ def SetActiveBeamLine(BeamLineName):
class IsotopeInfo(): class IsotopeInfo():
def __init__(self, A, Sym, energy, rate): def __init__(self, A, Sym, energy, rate):
self.Label1 = Label(canvas, text = A, fg = 'White', bg = 'black', bd = 0, font = ("Arial", 48))
self.Label2 = Label(canvas, text = Sym, fg = 'White', bg = 'black', bd = 0, font = ("Arial", 96))
self.Label1.place(x = 1600, y = 500, anchor = NE)
self.Label2.place(x = 1600, y = 500, anchor = NW)
self.Energy = Label(canvas, text = " @ " + str(energy) + " MeV/u", fg = 'White', bg = 'black', bd = 0, font = ("Arial", 96)) if A > 0 :
self.Energy.place(x = 1700, y = 500, anchor = NW) self.Label1 = Label(canvas, text = A, fg = 'White', bg = 'black', bd = 0, font = ("Arial", 48))
self.Label2 = Label(canvas, text = Sym, fg = 'White', bg = 'black', bd = 0, font = ("Arial", 96))
self.Label1.place(x = 1600, y = 500, anchor = NE)
self.Label2.place(x = 1600, y = 500, anchor = NW)
self.rateOrder = int(math.log(rate, 10)); self.Energy = Label(canvas, text = " @ " + str(energy) + " MeV/u", fg = 'White', bg = 'black', bd = 0, font = ("Arial", 96))
self.rateDigi = rate/ math.pow(10, self.rateOrder) self.Energy.place(x = 1770, y = 500, anchor = NW)
self.rate1 = Label(canvas, text = ("%.2f x 10" % self.rateDigi), fg = 'White', bg = 'black', bd = 0, font = ("Arial", 70)) self.rateOrder = int(math.log(rate, 10));
self.rate1.place(x = 2000, y = 700, anchor = NE) self.rateDigi = rate/ math.pow(10, self.rateOrder)
self.rate2 = Label(canvas, text = ("%d" % self.rateOrder), fg = 'White', bg = 'black', bd = 0, font = ("Arial", 35)) self.rate1 = Label(canvas, text = ("%.2f x 10" % self.rateDigi), fg = 'White', bg = 'black', bd = 0, font = ("Arial", 70))
self.rate2.place(x = 2000, y = 700, anchor = NW) self.rate1.place(x = 2000, y = 700, anchor = NE)
self.rate2 = Label(canvas, text = ("%d" % self.rateOrder), fg = 'White', bg = 'black', bd = 0, font = ("Arial", 35))
self.rate2.place(x = 2000, y = 700, anchor = NW)
self.rate3 = Label(canvas, text = "pps", fg = 'White', bg = 'black', bd = 0, font = ("Arial", 70))
self.rate3.place(x = 2050, y = 700, anchor = NW)
else:
self.Label2 = Label(canvas, text = "No Beam", fg = 'White', bg = 'black', bd = 0, font = ("Arial", 96))
self.Label2.place(x = 1600, y = 500, anchor = NW)
self.rate3 = Label(canvas, text = "pps", fg = 'White', bg = 'black', bd = 0, font = ("Arial", 70))
self.rate3.place(x = 2050, y = 700, anchor = NW)
class Clock(): class Clock():
def __init__(self): def __init__(self):
@ -524,7 +531,11 @@ Clarion2 = DetectorStation( bl2c_2.GetExitPos(), 100, "CLARION-2", BeamElementCo
#==================== Labels and info #==================== Labels and info
clock = Clock() clock = Clock()
IsotopeInfo(2, "H", 4.6, 6.1e+9) #BeamInfo = IsotopeInfo(2, "H", 4.6, 6.1e+9)
BeamInfo = IsotopeInfo(3, "He", 5, 6.1e+9)
#BeamInfo = IsotopeInfo( 0, "Off", 0, 0)
label = Label(canvas, text='hahaha') label = Label(canvas, text='hahaha')
label.place(x = windowSize[0] * 0.9, y = blS.GetExitPos()[1] - 100) label.place(x = windowSize[0] * 0.9, y = blS.GetExitPos()[1] - 100)

View File

@ -11,7 +11,7 @@
background-color : black; background-color : black;
} }
#iframe{ #iframe1{
position:absolute; position:absolute;
top : 60%; top : 60%;
left : 10%; left : 10%;
@ -20,6 +20,15 @@
z-index:1000; z-index:1000;
border: 1px solid green; border: 1px solid green;
} }
#iframe2{
position:absolute;
top : 60%;
left : 10%;
width: 100;
height: 100;
z-index:1001;
border: 1px solid green;
}
canvas{ canvas{
width: 99%; width: 99%;
@ -51,7 +60,8 @@
<div id='clock'></div> <div id='clock'></div>
<iframe src='https://fsunuc.physics.fsu.edu/grafana/' frameborder='2' id="iframe"></iframe> <iframe src="http://localhost:3000/d-solo/MFym59G4k/new-dashboard?orgId=1&from=1672071127881&to=1672092727881&theme=dark&panelId=2" id="iframe1"></iframe>
<iframe src="http://localhost:3000/d-solo/MFym59G4k/new-dashboard?orgId=1&from=1672071308654&to=1672092908654&panelId=4" id="iframe2"></iframe>
<canvas width="3840" height="2160" id='beamLine' > Your browser doe snot support HTML canvas</canvas> <canvas width="3840" height="2160" id='beamLine' > Your browser doe snot support HTML canvas</canvas>
<canvas width="3840" height="2160" id='static' > Your browser doe snot support HTML canvas</canvas> <canvas width="3840" height="2160" id='static' > Your browser doe snot support HTML canvas</canvas>
@ -98,5 +108,6 @@ setInterval(time, 1000);
</script> </script>
<script src="geo.js"></script> <script src="geo.js"></script>
<script src="FoxLabDashBoard/geo.js"></script>
</html> </html>