|
1 | | -"""Streamlit application script for displaying values using nipanel package.""" |
2 | | -import nipanel |
| 1 | +"""This is the panel that will use the logic.""" |
| 2 | + |
3 | 3 | import streamlit as st |
4 | 4 | import streamlit.components.v1 as components |
5 | 5 | from streamlit_echarts import st_echarts |
6 | 6 |
|
| 7 | +import nipanel |
| 8 | + |
7 | 9 | panel = nipanel.StreamlitPanelValueAccessor(panel_id="nidaqmx_continuous_analog_input_panel") |
8 | 10 |
|
9 | 11 | add_refresh_component = components.declare_component( |
10 | | - "panelRefreshComponent", |
11 | | - url=f"http://localhost:42001/panels/refresh/{panel.panel_id}",) |
| 12 | + "panelRefreshComponent", |
| 13 | + url=f"http://localhost:42001/panels/refresh/{panel.panel_id}", |
| 14 | +) |
12 | 15 | add_refresh_component() |
13 | 16 |
|
14 | 17 |
|
|
23 | 26 | } |
24 | 27 | </style> |
25 | 28 | """, |
26 | | - unsafe_allow_html=True |
| 29 | + unsafe_allow_html=True, |
27 | 30 | ) |
28 | 31 |
|
29 | 32 |
|
|
45 | 48 | "legend": {"data": ["thermocouple_amplitude"]}, |
46 | 49 | "xAxis": { |
47 | 50 | "type": "category", |
48 | | - "data":list(range(len(st.session_state.therm_history))), |
49 | | - "name": "Time" |
50 | | - }, |
51 | | - "yAxis": { |
52 | | - "type": "value", |
53 | | - "name": "Thermocouple Amplitude" |
| 51 | + "data": list(range(len(st.session_state.therm_history))), |
| 52 | + "name": "Time", |
54 | 53 | }, |
| 54 | + "yAxis": {"type": "value", "name": "Thermocouple Amplitude"}, |
55 | 55 | "series": [ |
56 | 56 | { |
57 | 57 | "name": "thermocouple_amplitude", |
58 | 58 | "type": "line", |
59 | 59 | "data": st.session_state.therm_history, |
60 | | - "color": "red" |
| 60 | + "color": "red", |
61 | 61 | }, |
62 | | - |
63 | | - |
64 | 62 | ], |
65 | 63 | } |
66 | 64 | st_echarts(options=therm_amp_graph, height="400px") |
|
71 | 69 | "xAxis": { |
72 | 70 | "type": "category", |
73 | 71 | "data": list(range(len(st.session_state.volts_history))), |
74 | | - "name": "Time" |
75 | | - }, |
76 | | - "yAxis": { |
77 | | - "type": "value", |
78 | | - "name": "Voltage Amplitude" |
| 72 | + "name": "Time", |
79 | 73 | }, |
| 74 | + "yAxis": {"type": "value", "name": "Voltage Amplitude"}, |
80 | 75 | "series": [ |
81 | 76 | { |
82 | 77 | "name": "voltage_amplitude", |
83 | 78 | "type": "line", |
84 | 79 | "data": st.session_state.volts_history, |
85 | 80 | }, |
86 | | - |
87 | 81 | ], |
88 | 82 | } |
89 | 83 | st_echarts(options=voltage_amp_graph, height="400px") |
|
95 | 89 | "xAxis": { |
96 | 90 | "type": "category", |
97 | 91 | "data": list(range(len(st.session_state.volts_history))), |
98 | | - "name": "Time" |
99 | | - }, |
100 | | - "yAxis": { |
101 | | - "type": "value", |
102 | | - "name": "Voltage and Thermocouple Amplitude" |
| 92 | + "name": "Time", |
103 | 93 | }, |
| 94 | + "yAxis": {"type": "value", "name": "Voltage and Thermocouple Amplitude"}, |
104 | 95 | "series": [ |
105 | 96 | { |
106 | 97 | "name": "voltage_amplitude", |
107 | 98 | "type": "line", |
108 | 99 | "data": st.session_state.volts_history, |
109 | | - "emphasis": {"focus":"series"}, |
| 100 | + "emphasis": {"focus": "series"}, |
110 | 101 | "smooth": True, |
111 | 102 | "seriesLayoutBy": "row", |
112 | 103 | }, |
|
115 | 106 | "type": "line", |
116 | 107 | "data": st.session_state.therm_history, |
117 | 108 | "color": "red", |
118 | | - "emphasis": {"focus":"series"}, |
| 109 | + "emphasis": {"focus": "series"}, |
119 | 110 | "smooth": True, |
120 | 111 | "seriesLayoutBy": "row", |
121 | 112 | }, |
|
129 | 120 | st.selectbox(options=["Mod1/ai2"], label="Physical Channels", disabled=True) |
130 | 121 | st.selectbox(options=["Off"], label="Logging Modes", disabled=False) |
131 | 122 | with center_volt_tab: |
132 | | - st.selectbox(options=["-5"],label="Min Value") |
133 | | - st.selectbox(options=["5"],label="Max Value") |
| 123 | + st.selectbox(options=["-5"], label="Min Value") |
| 124 | + st.selectbox(options=["5"], label="Max Value") |
134 | 125 | st.selectbox(options=["1000"], label="Samples per Loops", disabled=False) |
135 | 126 | with right_volt_tab: |
136 | 127 | st.selectbox(options=["default"], label="Terminal Configurations") |
137 | 128 | st.selectbox(options=["OnboardClock"], label="Sample Clock Sources", disabled=False) |
138 | 129 |
|
139 | | - |
| 130 | + |
140 | 131 | thermocouple_tab.header("Thermocouple") |
141 | 132 | with thermocouple_tab: |
142 | 133 | left, middle, right = st.columns(3) |
|
145 | 136 | st.selectbox(options=["0"], label="Min", disabled=False) |
146 | 137 | st.selectbox(options=["100"], label="Max", disabled=False) |
147 | 138 | st.selectbox(options=["Off"], label="Logging Mode", disabled=False) |
148 | | - |
| 139 | + |
149 | 140 | with middle: |
150 | | - st.selectbox(options=["Deg C"], label = "Units", disabled=False) |
| 141 | + st.selectbox(options=["Deg C"], label="Units", disabled=False) |
151 | 142 | st.selectbox(options=["J"], label="Thermocouple Type", disabled=False) |
152 | 143 | st.selectbox(options=["Constant Value"], label="CJC Source", disabled=False) |
153 | 144 | st.selectbox(options=["1000"], label="Samples per Loop", disabled=False) |
154 | 145 | with right: |
155 | | - st.selectbox(options=["25"],label="CJC Value", disabled=False) |
| 146 | + st.selectbox(options=["25"], label="CJC Value", disabled=False) |
156 | 147 | st.selectbox(options=["OnboardClock"], label="Sample Clock Source", disabled=False) |
157 | 148 | st.selectbox(options=[" "], label="Actual Sample Rate", disabled=True) |
158 | | - |
159 | | - |
160 | | - |
161 | | - |
162 | | - |
163 | | - |
164 | | - |
165 | | - |
166 | | - |
167 | | - |
168 | | - |
0 commit comments