コード例 #1
0
def labels_updater(n):

    if promt is not None:
        promt_label = html.H2(promt)
    else:
        promt_label = html.H1(' ')

    if mask_detected:
        mask_label = html.H2('Mask Detected', style={'color': 'green'})
        if body_temperature is not None:
            if temp_high:
                msg_label = html.H2('High Body Temperature Detected', style={'color': 'red'})
                temp_label = temp_label = daq.Thermometer(
                    id='thermometer',
                    min=95,
                    max=105,
                    value=body_temperature,
                    color='red',
                    style={'padding': '10px'}
                )
            elif temp_low:
                msg_label = html.H2('Normal Body Temperature', style={'color': 'green'})
                temp_label = temp_label = daq.Thermometer(
                    id='thermometer',
                    min=95,
                    max=105,
                    value=body_temperature,
                    color='green'
                )
        else:
            temp_label = daq.Thermometer(
                id='thermometer',
                min=95,
                max=105,
                value=body_temperature,
                color='blue'
            )
            msg_label = html.H2('Checking Temperature...')
    else:
        mask_label = html.H2('No Mask Detected', style={'color': 'red'})
        temp_label = temp_label = daq.Thermometer(
                id='thermometer',
                min=95,
                max=105,
                value=0,
                color='blue'
            )
        msg_label = html.H2('Detecting Mask...')
    return [html.H2(f'Visitor Id: {visitor_id}'),
            mask_label,
            temp_label,
            promt_label,
            msg_label]
コード例 #2
0
    def start(self, host_ip=None, port=8080, debug=False):
        thermometer_obj_list = list()
        div_list = [
            html.H1('TempLogger Dash'),
            dcc.Graph(
                id='live-update-graph',
                animate=True,
            ),
            dcc.Interval(
                id='interval-component',
                interval=self.plot_interval * 1000,  # in milliseconds
                n_intervals=0),
        ]
        callback_output_list = [
            Output('live-update-graph', 'figure'),
        ]
        for device in self._device_config:
            th_id = '{}-thermometer'.format(device.lower())
            callback_output_list.append(Output(th_id, 'value'))
            thermometer_obj_list.append(
                daq.Thermometer(
                    id=th_id,
                    value=20,
                    min=0,
                    max=35,
                    style={
                        'margin-bottom': '5%',
                        'width': '25%',
                        'display': 'inline-block',
                        'textAlign': 'center'
                    },
                    showCurrentValue=True,
                    units="C",
                    label='Current temperature, {}'.format(
                        self._device_config[device]['location'].capitalize()),
                    labelPosition='top'))
        div_list.append(
            html.Div(thermometer_obj_list, style={'textAlign': 'center'}))
        self._app.layout = html.Div(html.Div(div_list))

        @self._app.callback(callback_output_list,
                            [Input('interval-component', 'n_intervals')])
        def update_visualise(n):
            return self.visualise(n)

        if host_ip is None:
            hostname = socket.gethostname()
            host_ip = socket.gethostbyname(hostname)
        self._app.run_server(debug=debug, port=port, host=host_ip)
コード例 #3
0
def climate_scenario():
    return html.Div(children=[
        html.H5(dcc.Markdown("**Scenario Selector**")),
        html.Br(),
        daq.Thermometer(id='my-daq-thermometer',
                        min=0,
                        max=8.5,
                        scale={
                            'start': 0,
                            'interval': 8.5,
                            'labelInterval': 2,
                            'custom': {
                                2: 2.6,
                                4: 4.5,
                                6: 6.0
                            }
                        },
                        units="°C",
                        value=0)
    ])
コード例 #4
0
import dash
import dash_core_components as dcc
import dash_html_components as html
import dash_daq as daq

app = dash.Dash(__name__)

app.layout = html.Div(
    [daq.Thermometer(id='my-daq-thermometer', min=95, max=105, value=98.6)])

if __name__ == '__main__':
    app.run_server(debug=True)
コード例 #5
0
ファイル: app.py プロジェクト: muntakim1/sensorData
def UpdataPage(n_intervals):
    get_chunk = flow_from_df(df)
    for x in range(n_intervals):
        data = next(get_chunk)

    data.ts=pd.to_datetime(data['ts'],unit='ms')
    fig = make_subplots(rows=3, cols=2,horizontal_spacing=0.05, vertical_spacing=0.1,subplot_titles=("time vs CO","time vs humidity", "time vs temperature","time vs lpg","time vs Smoke"))
    fig['layout']['margin'] = {
        'l': 30, 'r': 10, 'b': 30, 't': 30
    }


    fig.append_trace({
        'x': data['ts'],
        'y': data['co'],
        'name': 'Time vs CO',
        'mode': 'lines+markers',
        'type': 'scatter'
    }, 1, 1)
    fig.append_trace({
        'x': data['ts'],
        'y': data['humidity'],
        'text': data['humidity'],
        'name': 'time vs humidity',
        'mode': 'lines+markers',
        'type': 'scatter'
    }, 2, 1)
    fig.append_trace({
        'x': data['ts'],
        'y': data['temp'],
        'text': data['humidity'],
        'name': 'time vs temperature',
        'mode': 'lines+markers',
        'type': 'scatter'
    }, 1, 2)
    fig.append_trace({
        'x': data['ts'],
        'y': data['lpg'],
        'text': data['lpg'],
        'name': 'time vs lpg',
        'mode': 'lines',
        'type': 'scatter'
    }, 2, 2)

    fig.append_trace({
        'x': data['ts'],
        'y': data['smoke'],
        'text': data['smoke'],
        'name': 'time vs smoke',
        'mode': 'lines',
        'type': 'scatter'
    }, 3, 1)
    fig.update_layout(height=700, showlegend=False)


  

    Tanker = daq.Gauge(
        
        value=data['lpg'].mean()*100,
        label='LPG in PPM',
        max=1,
        min=0,
        color={"gradient": True, "ranges": {
            "green": [0, .6], "yellow": [.6, .8], "red": [.8, 1]}},
    )

    Smoke = daq.Gauge(

        value=data['smoke'].mean()*100,
        label='Smoke in PPM',
        max=2.5,
        min=0,
        color={"gradient": True, "ranges": {
            "green": [0, 1.5], "yellow": [1.5, 2], "red": [2, 2.5]}},
    )
    Co = daq.Gauge(

        value=data['co'].mean()*100,
        label='CO in PPM',
        max=1,
        min=0,
        color={"gradient": True, "ranges": {
            "green": [0, .6], "yellow": [.6, .8], "red": [.8, 1]}},
    )

    Temp = daq.Thermometer(
        id='my-daq-thermometer',
        min=math.floor(data['temp'].min()),
        max=math.floor(data['temp'].max()),
        value=data['temp'].mean(),
        label="Temperature (F)",
        color="#9B51E0",
        
    )

    motion = daq.Indicator(
        id='my-daq-indicator',
        value=data['light'][:1].values[0],
        label="Light Status",
        color='#b71c1c',
        style={
            'color': '#black'
        }
    )

   
    hour = time.localtime(time.time())[3]
    hour = str(hour).zfill(2)

    minute = time.localtime(time.time())[4]
    minute = str(minute).zfill(2)
    Watch = daq.LEDDisplay(
            id='control-panel-utc-component',
            value=hour+':'+minute,
            label='Watch',
            size=50,
        color='#4a148c',
        )
    Row=dbc.Row(
        children=[
            dbc.Col(
                children=[motion, html.Br(),Watch]
            ),
            dbc.Col(
                children=[ Temp]
            ),
            dbc.Col(
                children=[Tanker]
            ),
           
            dbc.Col(
                children=[Smoke]
            ),
            dbc.Col(
                children=[Co]
            )
        ]
        )

    charts = dcc.Graph(figure=fig, config={"displayModeBar": False})
    return [Row, charts]
        targets = {"25": {"label": "TARGET"}},
        color=theme['primary'],
        id='darktheme-daq-slider',
        className='dark-theme-control'
    ), html.Br(),
    daq.Tank(
        min=0,
        max=10,
        value=5,
        id='darktheme-daq-tank',
        className='dark-theme-control'
    ), html.Br(),
    daq.Thermometer(
        min=95,
        max=105,
        value=98.6,
        id='darktheme-daq-thermometer',
        className='dark-theme-control'
    ), html.Br()
])

app.layout = html.Div(id='dark-theme-container', children=[
    daq.ToggleSwitch(
        id='toggle-theme',
        label=['Light', 'Dark'],
        value=True
    ),
    html.Br(),
    html.Div(
        id='theme-colors',
        children=[
コード例 #7
0
ファイル: app.py プロジェクト: roubenk/covid-crowd-risk
                      for i in range(4)},
               min=0,
               max=3,
               value=1,
               step=0.01,
               updatemode="drag")
])

result_label = html.Div(
    [html.H3(id="result-label"),
     html.H6("chance of exposure")])

result = html.Div(
    daq.Thermometer(id="result-thermometer",
                    value=0,
                    min=0,
                    max=100,
                    color="#f05454"))

data_attribution = html.Div([
    html.Span("Data from the "),
    html.A("State of California", href="https://www.ca.gov/", target="_blank"),
    html.Span(" and the "),
    html.A("US Census Bureau", href="https://www.census.gov/", target="_blank")
])

icon_attribution = html.Div([
    html.Span("Icons made by "),
    html.A("Freepik",
           href="https://www.flaticon.com/authors/freepik",
           target="_blank"),
コード例 #8
0
import dash
import dash_daq as daq
import dash_core_components as dcc
import dash_html_components as html

external_stylesheets = ['https://codepen.io/chriddyp/pen/bWLwgP.css']

app = dash.Dash(__name__, external_stylesheets=external_stylesheets)

app.layout = html.Div([
    daq.Thermometer(id='my-thermometer',
                    value=5,
                    min=0,
                    max=10,
                    style={'margin-bottom': '5%'}),
    dcc.Slider(
        id='thermometer-slider',
        value=5,
        min=0,
        max=10,
    ),
])


@app.callback(dash.dependencies.Output('my-thermometer', 'value'),
              [dash.dependencies.Input('thermometer-slider', 'value')])
def update_thermometer(value):
    return value


if __name__ == '__main__':
コード例 #9
0
def update_values(value, n_intervals):
    cpu_temp = 50.0
    pcb_temp = 30.0
    system_time = 100
    b_v = 12.0
    battery_voltage = "%2.2f" % (b_v)
    memory_usage = 34
    memory_max = 35
    cpu_usage = 50
    clock_speed = 1500
    cpu_colour = "#44ff00"
    if cpu_temp > 70: cpu_colour = "#ff0000"
    elif cpu_temp > 60: cpu_colour = "#ff5500"
    elif cpu_temp > 55: cpu_colour = "#ff8800"
    elif cpu_temp > 50: cpu_colour = "#ffaa00"
    elif cpu_temp > 45: cpu_colour = "#dddd00"
    pcb_colour = "#44ff00"
    if pcb_temp > 45: pcb_colour = "#ff0000"
    elif pcb_temp > 40: pcb_colour = "#ff5500"
    elif pcb_temp > 35: pcb_colour = "#ff8800"
    elif pcb_temp > 30: pcb_colour = "#ffaa00"
    elif pcb_temp > 25: pcb_colour = "#dddd00"
    battery_bg_col = "#ffffff"
    battery_fg_col = "#00ff00"
    if (b_v < 10):
        battery_bg_col = "#ff0000"
        battery_fg_col = "#000000"
    elif (b_v < 11):
        battery_fg_col = "#ff0000"
    ret = html.Div([
        html.Div(
            [
                daq.Thermometer(
                    label="PCB Temp",
                    showCurrentValue=True,
                    units="C",
                    value=pcb_temp,
                    color=pcb_colour,
                    min=0,
                    max=100,
                    size=130,
                    style={
                        "textAlign": "center",
                        "width": "15%"
                    },
                ),
                daq.Thermometer(
                    label="CPU Temp",
                    showCurrentValue=True,
                    units="C",
                    value=cpu_temp,
                    color=cpu_colour,
                    min=0,
                    max=100,
                    size=130,
                    style={
                        "textAlign": "center",
                        "width": "15%"
                    },
                ),
                html.Div([
                    daq.LEDDisplay(
                        label="Battery Voltage",
                        value=battery_voltage,
                        color=battery_fg_col,
                        backgroundColor=battery_bg_col,
                        size=40,
                    ),
                    daq.LEDDisplay(
                        label="Clock Speed",
                        value=clock_speed,
                        color="#FF5E5E",
                        size=40,
                    ),
                ],
                         style={
                             "textAlign": "center",
                             "width": "19%"
                         }),
                daq.Gauge(
                    showCurrentValue=True,
                    units="Percent",
                    min=0,
                    max=100,
                    value=cpu_usage,
                    color="#FF5E5E",
                    label="CPU Usage",
                    size=190,
                    style={
                        "textAlign": "center",
                        "width": "23%"
                    },
                ),
                daq.Gauge(
                    showCurrentValue=True,
                    units="MB",
                    min=0,
                    max=memory_max,
                    value=memory_usage,
                    color="#FF5E5E",
                    label="Memory Usage",
                    size=190,
                    style={
                        "textAlign": "center",
                        "width": "23%"
                    },
                ),
            ],
            style=flex_style,
        ),
        html.Div('Last response time: {}'.format(
            utils.decode_time(system_time).rstrip("0"))),
    ])
    return ret
コード例 #10
0
Thermometer = html.Div(children=[
    html.H1('Thermometer Examples and Reference'),
    html.Hr(),
    html.H3('Default Thermometer'),
    reusable_components.Markdown("An example of a default Thermometer without \
            any extra properties."),
    reusable_components.Markdown(
        examples['thermometer'][0],
        style=styles.code_container
    ),
    html.Div(
        examples['thermometer'][1],
        className='example-container',
        style={'overflow-x': 'initial'}
    ),

    html.Hr(),

    html.H3('Current value with units'),
    reusable_components.Markdown("Display the value of the thermometer along with \
    optional units with ` showCurrentValue` and `units`."),
    ComponentBlock('''import dash_daq as daq
daq.Thermometer(
    min=95,
    max=105,
    value=100,
    showCurrentValue=True,
    units="C"
)''', style=styles.code_container),

    html.Hr(),

    html.H3('Height and width'),
    reusable_components.Markdown("Control the size of the thermometer by setting \
    `height` and `width`."),
    ComponentBlock('''import dash_daq as daq
daq.Thermometer(
    value=5,
    height=150,
    width=5
)''', style=styles.code_container),

    html.Hr(),

    html.H3('Label'),
    reusable_components.Markdown("Display a label alongside the thermometer in \
    the specified positon by setting `label` and `labelPosition`."),
    ComponentBlock('''import dash_daq as daq
daq.Thermometer(
    value=5,
    label='Current temperature',
    labelPosition='top'
)''', style=styles.code_container),

    html.Hr(),

    html.H3('Custom scales'),
    reusable_components.Markdown("Control the intervals at which labels are displayed, \
    as well as the labels themselves with the `scale` property."),
    ComponentBlock('''import dash_daq as daq
daq.Thermometer(
    value=5,
    scale={'start': 2, 'interval': 3,
    'labelInterval': 2, 'custom': {
        '2': 'ideal temperature',
        '5': 'projected temperature'
    }}
)''', style=styles.code_container),

    html.Hr(),

    html.H3('Thermometer Properties'),
    generate_prop_info("Thermometer", lib=daq)

])
コード例 #11
0
import dash  
import dash_daq as daq   

app = dash.Dash(__name__)

app.layout = daq.Thermometer(
    value=80,min=-10, max=100, height=300
)

app.run_server(debug=True)
コード例 #12
0
        ),
        daq.GraduatedBar(
            id='packaging-levels',
            min=0, max=100,
            step=5,
            color='blue',
            label='Packaging materials'
        )
    ]),
    html.Div(
        className='indicator-box',
        children=[
            html.H4("Manufacturing room temperature"),
            daq.Thermometer(
                id='manufacturing-temp', 
                min=50, max=90,
                value=70,
                color='blue'
            )
        ]
    ),
    dcc.Interval(
        id='polling-interval',
        n_intervals=0,
        interval=1*1000,
        disabled=True
    ),
    dcc.Store(
        id='annotations-storage',
        data=[]
    )
])
コード例 #13
0
                           },
                           50: {
                               'label': '50'
                           },
                           75: {
                               'label': '75'
                           }
                       }),
        ]),
    ],
             className="pretty_container four columns"),
    html.Div([
        daq.Thermometer(
            id='my-gauge',
            showCurrentValue=True,
            #color={"gradient":True,"ranges":{"red":[0,40],"yellow":[41,68],"green":[68.1,100]}},
            label="Will Paper 7 be healthy?",
            max=100,
            min=0,
            value=60),
    ])
])


@app.callback(Output('my-gauge', 'value'), [
    Input('p1', 'value'),
    Input('p2', 'value'),
    Input('p3', 'value'),
    Input('p4', 'value'),
    Input('p5', 'value'),
    Input('p6', 'value'),
])
コード例 #14
0
             units="PSI",
        value=5,
        showCurrentValue=True,
        )
meter_4=daq.Gauge(
    color={"ranges":{"green":[0,5],"yellow":[5,9],"red":[9,10]}},
        label="Tank-4",
            units="PSI",
        value=5,
        showCurrentValue=True,
        )


thm_1=daq.Thermometer(
    label="Tank-1",
        units="C",
        value=5,
        showCurrentValue=True,
        )
thm_2=daq.Thermometer(
        label="Tank-2",
        units="C",
        value=5,
        showCurrentValue=True,

        )
thm_3=daq.Thermometer(
        label="Tank-3",
             units="C",
        value=5,
        showCurrentValue=True,
        )
コード例 #15
0
          style={'width': '100%'}),
 html.Br(),
 html.Br(),
 html.P(
     "The Svalbard area is one of the fastest-warming places on Earth and this trend is forecasted to continue. "
     "The thermometer below shows the temperature anomaly compared to the 30-year average of 1961 - 1990.",
     style={'text-align': 'center'}),
 html.H3(id='output-thermometer-header', style={'text-align': 'center'}),
 html.Div(
     [
         daq.Thermometer(label='Temperature anomaly',
                         labelPosition='top',
                         id='my-thermometer',
                         min=0,
                         max=12,
                         showCurrentValue=True,
                         color='red',
                         style={
                             'margin-bottom': '5%',
                             'backgroundColor': 'transparent'
                         }),
     ],
     style={
         'width': '100%',
         'display': 'inline-block',
         'align-items': 'left',
         'justify-content': 'left'
     }),
 html.Img(src=app.get_asset_url('SvalbardIMG3.jpg'),
          style={'width': '100%'}),
 html.Br(),
コード例 #16
0
def update_values(value, n_intervals):
    data = pd.read_csv('/ramdisk/system.csv')
    try:
        current_values = data[[
            'system-time', 'battery-voltage', 'total-cpu-load', 'clock-speed',
            'pcb-temp', 'cpu-temp', 'gpu-temp', 'memory-used', 'memory-total'
        ]].tail(1).iloc[0]
        cpu_temp = float(current_values['cpu-temp'])
        pcb_temp = float(current_values['pcb-temp'])
        system_time = round(current_values['system-time'], 3)
        b_v = float(current_values['battery-voltage'])
        battery_voltage = "%2.2f" % (b_v)
        memory_usage = int(current_values['memory-used'])
        memory_max = int(current_values['memory-total'])
        cpu_usage = float(current_values['total-cpu-load'])
        clock_speed = "%04d" % int(current_values['clock-speed'])
        cpu_colour = "#44ff00"
        if cpu_temp > 70: cpu_colour = "#ff0000"
        elif cpu_temp > 60: cpu_colour = "#ff5500"
        elif cpu_temp > 55: cpu_colour = "#ff8800"
        elif cpu_temp > 50: cpu_colour = "#ffaa00"
        elif cpu_temp > 45: cpu_colour = "#dddd00"
        pcb_colour = "#44ff00"
        if pcb_temp > 45: pcb_colour = "#ff0000"
        elif pcb_temp > 40: pcb_colour = "#ff5500"
        elif pcb_temp > 35: pcb_colour = "#ff8800"
        elif pcb_temp > 30: pcb_colour = "#ffaa00"
        elif pcb_temp > 25: pcb_colour = "#dddd00"
        battery_bg_col = "#ffffff"
        battery_fg_col = "#00ff00"
        if (b_v < 10):
            battery_bg_col = "#ff0000"
            battery_fg_col = "#000000"
        elif (b_v < 11):
            battery_fg_col = "#ff0000"
        ret = html.Div([
            html.Div(
                [
                    daq.Thermometer(
                        label="PCB Temp",
                        showCurrentValue=True,
                        units="C",
                        value=pcb_temp,
                        color=pcb_colour,
                        min=0,
                        max=100,
                        size=130,
                        style={
                            "textAlign": "center",
                            "width": "15%"
                        },
                    ),
                    daq.Thermometer(
                        label="CPU Temp",
                        showCurrentValue=True,
                        units="C",
                        value=cpu_temp,
                        color=cpu_colour,
                        min=0,
                        max=100,
                        size=130,
                        style={
                            "textAlign": "center",
                            "width": "15%"
                        },
                    ),
                    html.Div([
                        daq.LEDDisplay(
                            label="Battery Voltage",
                            value=battery_voltage,
                            color=battery_fg_col,
                            backgroundColor=battery_bg_col,
                            size=40,
                        ),
                        daq.LEDDisplay(
                            label="Clock Speed",
                            value=clock_speed,
                            color="#FF5E5E",
                            size=40,
                        ),
                    ],
                             style={
                                 "textAlign": "center",
                                 "width": "19%"
                             }),
                    daq.Gauge(
                        showCurrentValue=True,
                        units="Percent",
                        min=0,
                        max=100,
                        value=cpu_usage,
                        color="#FF5E5E",
                        label="CPU Usage",
                        size=190,
                        style={
                            "textAlign": "center",
                            "width": "23%"
                        },
                    ),
                    daq.Gauge(
                        showCurrentValue=True,
                        units="MB",
                        min=0,
                        max=memory_max,
                        value=memory_usage,
                        color="#FF5E5E",
                        label="Memory Usage",
                        size=190,
                        style={
                            "textAlign": "center",
                            "width": "23%"
                        },
                    ),
                ],
                style=flex_style,
            ),
            html.Div('Last response time: {}'.format(
                utils.decode_time(system_time).rstrip("0"))),
        ])
    except IndexError:
        ret = html.Div(
            'Could not read system status file.\nIs core.py running, ramdisk correctly setup and system polling enabled in settings.py?'
        )
    return ret
コード例 #17
0
                     {'label': '1 Day Ago', 'value': 'day'},
                     {'label': '1 Week Ago', 'value': 'week'},
                     {'label': '1 Month Ago', 'value': 'month'},
                     {'label': 'None', 'value': 'fake'}
                 ],
                 value='fake',
                 style=theme
             )
         ])
     ]),
 ]),
 html.Div(className='indicator-box'+class_theme['dark'], id='tmp1-container', children=[
     html.H4("Blue CCD Temperature"), # Temperautre Thermometer for Blue CCD
     daq.Thermometer(id='tmp1-temp',
         min=0, max=273,
         value=100,
         color='blue'
     ),
     html.Br(),
     daq.LEDDisplay( # display temperature as LED box in K for Blue CCD
         id='tmp1-k-temperature',
         value='000000',
         color='blue',
         label={'label': 'K', 'style': {'font-size': '24pt'}},
         labelPosition='right'
     ),
     html.Br(),
     daq.LEDDisplay( # display temperature in LED box in C for Blue CCD
         id='tmp1-c-temperature',
         value='000000',
         label={'label': 'C', 'style': {'font-size': '24pt'}},
コード例 #18
0
ファイル: daq2.py プロジェクト: shuvro-baset/Dash-by-Plotly
                     "start": 40,
                     "labelInterval": 10,
                     "interval": 10
                 },
                 color={
                     "gradient": True,
                     "ranges": {
                         "blue": [30, 75],
                         "red": [75, 100]
                     },
                 },
             ),
             className="two columns",
         ),
         html.Div(
             daq.Thermometer(id="my-thermometer", min=30, max=99, value=40),
             className="three columns",
         ),
     ],
     className="row",
 ),
 html.Div(
     [
         html.Div(
             daq.LEDDisplay(id="my-leddisplay", value="40",
                            color="#39FF14"),
             className="four columns",
         ),
         html.Div(
             daq.ColorPicker(
                 id="my-colorpicker",
コード例 #19
0
        }
    }
           for index, depth_value in enumerate(get_depth_data())},
    included=False,
    vertical=True,
    # tooltip={"placement": "topLeft"},
    className="depthSlider")

# themometer to show temperature:
themometer = daq.Thermometer(
    id='thermometer',
    className="thermometer",
    value=0,
    min=0,
    max=40,
    # style={'height': '100vh'},
    color=" #f83a3a",
    showCurrentValue=True,
    units=u'\N{DEGREE SIGN}' + "C",
    # size= '25%'#300,
    # labelPosition = "top",
    # label="hello"
)

# a block with all the required indicators:
indicators = html.Div(
    id="tempIndicators",
    className="tempIndicators",
    children=[
        html.Div(id="surfaceMaxT",
                 children=[
                     "Surface Maximum Temperature = NaN " +
コード例 #20
0
def homepageDisplay(latestSensorData):
    # need to do this to get data for each sensor in the loop below
    df2 = latestSensorData.set_index('sensorID', drop=False)
    j = []  # this list holds section for each sensor
    # now loop for each sensor node
    # if more sensor nodes are available, change the range to sensorID + 1
    # (i.e. if you have installed sensor 5, change the last number to 6
    for sID in range(1, 5):
        #card creates a border around the sensors gauges
        k = [
            dbc.Card(
                body=True,
                color='primary',
                outline=True,
                className='mt-2',
                children=[
                    dbc.Row([
                        # show the sensor number and latest timestamp for this sensor
                        dbc.Col(
                            [
                                html.H4('Sensor {:d}'.format(sID)),
                                html.Div('Latest update'),
                                html.Div(df2.at[sID, 'timestamp'])
                            ],
                            width=2,
                        ),
                        # show the temp in a thermometer
                        dbc.Col(
                            daq.Thermometer(
                                min=-10,
                                max=50,
                                value=df2.at[sID, 'data.bmp180_temperature'],
                                scale={
                                    'start': -10,
                                    'interval': 5
                                },
                                showCurrentValue=True,
                                units="C"),
                            width="auto",
                        ),
                        # show humidity in a gauge
                        dbc.Col(
                            daq.Gauge(
                                showCurrentValue=True,
                                units="Rel.Humidity%",
                                value=df2.at[sID, 'data.humidity'],
                                label='Humidity',
                                max=100,
                                min=0,
                                size=200,
                            ),
                            width="auto",
                        ),
                        # show air pressure in a gauge
                        dbc.Col(
                            daq.Gauge(
                                showCurrentValue=True,
                                units="Hectopascals (hPa)",
                                value=df2.at[sID, 'data.bmp180_airpressure'],
                                label='Barometer',
                                max=1200,
                                min=800,
                                size=200,
                            ),
                            width="auto",
                        ),
                        # uses two rows to have the displays right under each other while still being
                        # in the same row as the other gauges to show particulates reading as an LED display
                        dbc.Col(
                            [
                                dbc.Row(
                                    daq.LEDDisplay(
                                        label="PM2.5 (µg/m3)",
                                        labelPosition='bottom',
                                        backgroundColor="#5be4fc",
                                        color="#000000",
                                        value=df2.at[sID,
                                                     'data.pm25'].round(2)), ),
                                dbc.Row(
                                    daq.LEDDisplay(
                                        label="PM10 (µg/m3)",
                                        labelPosition='bottom',
                                        backgroundColor="#5be4fc",
                                        color="#000000",
                                        value=df2.at[sID,
                                                     'data.pm10'].round(2)), )
                            ],
                            width="auto",
                            align="center",
                        ),
                    ])
                ])
        ]
        j.extend(k)  # add section for each sensor to overall list of sections
    l = html.Div(children=[
        dbc.Card(
            dbc.CardBody(j)  # put all the sections inside another outer card
        )
    ])
    # return the overall homepage content
    return l
コード例 #21
0
ファイル: app.py プロジェクト: davidzyx/ca-wildfire-risk

# Geo Location Based Prediction
month_picker_slider2 = dcc.Slider(
    id='month_slider2',
    min=1,
    max=12,
    marks={
        1: "January", 2: "February", 3: "March", 4: "April", 5: "May", 6: "June", 7: "July", 8: "August", 9: "September", 10: "October", 11: "November", 12: "December"
    },
    step=1,
    value=1,
)

month_picker_row2 = html.Div(style={'textAlign': 'center', 'padding-bottom':'2rem'}, children=[html.Div(children='Query a Month:'), month_picker_slider2])
th = daq.Thermometer(id = 'th', value=0.00, min=0.00, max=100, showCurrentValue=True, width=20, height=450, label='Risk Percentage')

label_cali_map2 = html.Div(html.H3(''),style={'margin-bottom':5, 'margin-left':5})
cali_map2 = dl.Map([dl.TileLayer(), dl.LayerGroup(id="layer")], id='map-id', style={'width':'100%', 'height':550}, center=[37.219306366090116, -119.66673872628975], zoom=5)
cali_map_subdiv2 = html.Div(id = 'cal-map2',style={'columnCount': 2}, children=[cali_map2, th])
cali_map_div2 = html.Div(id = 'calmap2', children=[label_cali_map2, cali_map_subdiv2])
pred_div2 = html.Div(id = 'pred', children=[month_picker_row2, html.H3(className='county_graph_title', children=[f'Please pick a point from the map below']), cali_map_div2])
# End of Geo Located Based Prediction


# Building App 
app.title = 'Cal Fire Dashboard'
app.layout = html.Div(children=[dcc.Location(id='url', refresh=False), header, navbar, html.Div(id='page-content', children=[prompt_message_container, our_services])])


# Observer Functions
コード例 #22
0
     dbc.CardBody([
         html.H5("Project by - Saurav Ganguly",
                 className='text-danger')
     ]),
 ],
          color="danger",
          outline=True,
          className='text-center'),
 dbc.Card([
     dbc.CardHeader("Temperature",
                    className='h4 text-light bg-danger'),
     dbc.CardBody([
         daq.Thermometer(id='thermometer',
                         min=95,
                         max=105,
                         showCurrentValue=True,
                         units="C",
                         color="#FF5E5E",
                         className='pt-2')
     ]),
 ],
          color="danger",
          outline=True,
          className='text-center'),
 dbc.Card([
     dbc.CardHeader("Battery", className='h4 text-light bg-danger'),
     dbc.CardBody([
         daq.GraduatedBar(id='graduatedbar',
                          showCurrentValue=True,
                          step=2,
                          max=100,
コード例 #23
0
ファイル: dashteste.py プロジェクト: Juliaalv/Banco-de-Dados
                    style={
                        'height': '300px',
                        'border-color': 'black'
                    }),

                # centro esquerda
                html.Div(
                    [
                        daq.Thermometer(
                            id='left-top-graph',
                            value=25,
                            label='Temperatura Ambiente',
                            min=0,
                            max=45,
                            color='yellow',
                            scale={
                                'start': 0,
                                'interval': 5,
                                'labelInterval': 1,
                            },
                            showCurrentValue=True,
                            units="C",
                        )
                    ],
                    className='three columns',  #  width: 30.6666666667%;
                    style={
                        'height': '300px',
                        'border-color': 'black'
                    }),
                html.Div(
                    [displays()],
コード例 #24
0
        }},
    value=0,
    min=0,
    labelPosition='top',
    label={'label': "Avg. Speed (km/h)", 'style': {'font-size': 25}},
    max=30
)

termo = daq.Thermometer(
    id='thermometer_widget',
    color='#D796EE',
    value=0,
    min=(-5),
    max=25,
    labelPosition='top',
    label={
        'label': "Avg. Temperature (°C)",
        'style': {
            'font-size': 25
        }},
    style={
        'margin-bottom': '5%'
    }
)

duration = daq.LEDDisplay(
    id='duration_widget',
    label={'label': "Avg. Duration (s)", 'style': {'font-size': 25}},
    labelPosition='top',
    value=0,
    color='#28435c'
)
コード例 #25
0
                              "ranges": {
                                  "green": [0, 8],
                                  "yellow": [8, 14],
                                  "red": [14, 20]
                              }
                          },
                          size=500,
                          style={
                              'display': 'inline-block',
                              'margin': '5%'
                          }),
         daq.Thermometer(id='ondoke',
                         min=0,
                         max=100,
                         showCurrentValue=True,
                         style={
                             'display': 'inline-block',
                             'marginLeft': '15%'
                         },
                         size=500),
         dcc.Interval(id='intervalComp', interval=1000, n_intervals=0),
     ],
              style={'marginLeft': '10%'}),
 ],
          style={'margin': '5%'}),
 html.Div([
     html.Div([html.H3(['Dash Cytoscape'], style=compTitle)]),
     html.Div([
         dcc.Dropdown(
             id='dropdown-update-layout',
             value='grid',
コード例 #26
0
                                  color='blue',
                                  label='Catalyst'),
                 daq.GraduatedBar(id='packaging-levels',
                                  min=0,
                                  max=100,
                                  step=5,
                                  color='blue',
                                  label='Packaging materials')
             ]),
    html.Div(className='indicator-box',
             id='temperature-container',
             children=[
                 html.H4("tmp1"),
                 daq.Thermometer(id='manufacturing-temp',
                                 min=0,
                                 max=273,
                                 value=100,
                                 color='blue')
             ])
])

temperatureRoot2 = html.Div()

powerRoot2 = html.Div([
    html.Div(id='PWSTATA-container',
             children=[
                 html.Div(className='indicator-box',
                          id='pwstata-status',
                          children=[
                              html.H4("Power Bank A"),
                              daq.Indicator(id='pwa1-status',
コード例 #27
0
import dash
import dash_daq as daq
import dash_core_components as dcc
import dash_html_components as html
import random

external_stylesheets = ['https://codepen.io/chriddyp/pen/bWLwgP.css']

app = dash.Dash(__name__, external_stylesheets=external_stylesheets)

app.layout = html.Div([
    daq.Thermometer(id='my-thermometer',
                    value=5,
                    min=30,
                    max=110,
                    style={'margin-bottom': '5%'},
                    showCurrentValue=True,
                    units="F",
                    label='Current temperature',
                    labelPosition='top',
                    color='red'),
    dcc.Interval(
        id='interval-component',
        interval=1 * 1000,  # in milliseconds
        n_intervals=0),
])


@app.callback(dash.dependencies.Output('my-thermometer', 'value'),
              [dash.dependencies.Input('interval-component', 'n_intervals')])
def update_thermometer(n_intervals):
    value = random.uniform(40, 100)