I have a daq.Gauge chart and want to update the ‘value’ and ‘max’ based on data from external module.
html.Div([
daq.Gauge(
id='gauge-chart',
color={"gradient": True, "ranges": {
"green": [0, 6], "yellow":[6, 8], "red":[8, 10]}},
value=2,
max=10,
min=0,
units="MPH",
)
], className='row', style={'textAlign': 'center'}),
Now I have a second module streamer.py, which creates a random number. This random number should be displayed as ‘value’ in the gauge. The ‘max’ value for the gauge must be set dynamically as well, because the random number could be any number bigger then max=10.
@app.callback(
Output('gauge-chart', 'value'),
Output('gauge-chart', 'max'),
[Input(***<SOURCE FROM STRAMER.PY>***)]
)
def update_gauge(value):
**CODE HERE**
return value, max
QUESTION 1:
How could I access the data from streamer.py in the Input?
QUESTION 2:
For simplicity, I’ve tested with a separate dcc.input:
dcc.Input(id='test_input', value='5', type='number'),
@app.callback(
Output('gauge-chart', 'value'),
# Output('gauge-chart', 'max'),
[Input('test_input', 'value')]
)
def update_gauge(value):
max = 12
return value, max
This gives me an error:TypeError: ‘Output’ object is not iterable