diff --git a/src/App.css b/src/App.css index 907f26c..2c7eae0 100644 --- a/src/App.css +++ b/src/App.css @@ -1,7 +1,7 @@ .App { align-items: center; - background-color: #052b00; - color: white; + background-color: #061a10; + color: #bfbfbf; font-size: calc(12px + 2vmin); justify-content: center; min-height: 100vh; diff --git a/src/App.js b/src/App.js index 63f2864..76f48a3 100644 --- a/src/App.js +++ b/src/App.js @@ -4,6 +4,7 @@ import GammaBar from './components/GammaBar'; import { Button, ButtonGroup } from '@material-ui/core'; import gamma from './static/gamma.json'; +import gamma_norm from './static/gamma_norm.json'; import { GAMMA } from './utils/consts'; @@ -11,13 +12,14 @@ import './App.css'; const STATE = { INITIAL: 0, + GAMMA_NORM: 1, GAMMA: 3 } class App extends React.Component { constructor(props) { super(props); - this.state = { content: STATE.INITIAL, tooltipVisible: false, tooltipX: '', tooltipY: '', title: "Sirius - Gamma Detectors" }; + this.state = { content: STATE.INITIAL, tooltipVisible: false, tooltipX: '', tooltipY: '' }; } customTooltipCallback = (tooltipModel) => { @@ -41,10 +43,11 @@ class App extends React.Component { } else { return
-
{this.state.title}
-
+
Sirius - Gamma Detectors
+
Gamma Detector Counting Readings

+
@@ -72,7 +75,9 @@ class App extends React.Component { renderGraph = () => { switch (this.state.content) { case STATE.GAMMA: - return + return + case STATE.GAMMA_NORM: + return default: if (this.state.tooltipVisible) { this.setState({ tooltipVisible: false }); } return
; diff --git a/src/components/GammaBar.jsx b/src/components/GammaBar.jsx index 8f09c8e..72cfc03 100644 --- a/src/components/GammaBar.jsx +++ b/src/components/GammaBar.jsx @@ -24,7 +24,7 @@ class GammaBar extends React.Component { tooltipVisible: false, minorVal: props.high ? props.high : 2000, minorArray: props.pvs.map(() => props.high ? props.high : 1e-8), - majorVal: props.hihi ? props.hihi : 200, + majorVal: props.hihi ? props.hihi : 100, majorArray: props.pvs.map(() => props.hihi ? props.hihi : 1e-7), maxVal: null, }; @@ -32,6 +32,7 @@ class GammaBar extends React.Component { this.timer = null; this.refreshInterval = 100; this.epics = new Epics(this.props.pvs); + this.epicscurrent = new Epics(['SI-13C4:DI-DCCT:Current-Mon']); this.values = []; this.alarms = { bg: [], border: [] }; @@ -46,13 +47,14 @@ class GammaBar extends React.Component { const { minorVal, majorVal } = this.state; const { pvs } = this.props; - this.values = pvs.map(pv => { return this.epics.pvData[pv].value; }); + this.values = pvs.map(pv => { return this.epics.pvData[pv].value.toExponential(2); }); + this.currentvalue = this.epicscurrent.pvData['SI-13C4:DI-DCCT:Current-Mon'].value.toExponential(2); this.valuesMax = Math.max(...this.values); this.alarms.bg = this.values.map(value => { if (value && !isNaN(value)) { if (value < minorVal) { - return color.OK_BG; + return color.OK_GAMMA_BG; } else if (value >= minorVal && value < majorVal) { return color.MINOR_BG; } else { @@ -68,12 +70,12 @@ class GammaBar extends React.Component { this.alarms.border = this.values.map(value => { if (value && !isNaN(value)) { if (value < minorVal) { - return color.OK_LINE; + return color.OK_GAMMA_LINE; } else if (value >= minorVal && value < majorVal) return color.MINOR_LINE; } else { /** Same as the alarm.bg*/ - return color.OK_LINE; + return color.OK_GAMMA_LINE; } }); } @@ -91,11 +93,11 @@ class GammaBar extends React.Component { labels: pvs, datasets: [ { - label: 'MKS - Cold Cathode', + label: 'Gamma', backgroundColor: this.alarms.bg, borderColor: this.alarms.border, borderWidth: 1, - hoverBackgroundColor: color.OK_BG, + hoverBackgroundColor: color.OK_GAMMA_BG, hoverBorderColor: color.HOVER_LINE, data: this.values, }, @@ -129,22 +131,19 @@ class GammaBar extends React.Component { componentDidMount() { this.timer = setInterval(this.updateContent, this.refreshInterval); } - componentWillUnmount() { clearInterval(this.timer); this.epics.disconnect(); } + componentWillUnmount() { clearInterval(this.timer); this.epics.disconnect(); this.epicscurrent.disconnect();} renderBar() { const { majorVal, minorVal, maxVal } = this.state; const { customTooltipCallback } = this.props; + const { labely } = this.props; return ( +
+
{title}
+ {this.state.chartData ?
{this.renderBar()}
: 'loading...'}
+ {'\nSI-13C4:DI-DCCT:Current-Mon: ' + this.currentvalue + " mA"} +
); } } diff --git a/src/utils/Colors.js b/src/utils/Colors.js index 05140ce..c085af3 100644 --- a/src/utils/Colors.js +++ b/src/utils/Colors.js @@ -10,6 +10,9 @@ class Color{ this.OK_BG = 'rgba(65,190,60,0.9)'; this.OK_LINE = 'rgba(65,190,60,0.6)'; + this.OK_GAMMA_BG = 'rgba(148, 79, 24,0.9)'; + this.OK_GAMMA_LINE = 'rgba(148, 79, 24,0.6)'; + this.MINOR_BG = 'rgba(359, 200, 0, 0.8)'; this.MINOR_LINE = 'rgba(359 ,200, 0, 1)';