Materialise css 的 CSS 版本不可用

Materialise css 的 CSS 版本不可用

import dash
from dash.dependencies import Output ,輸入
import dash_core_components as dcc import dash_html_components as html
importplotly ,隨機 導入
plotly.graph_objs as go
from collections importplotly
:

app = dash.Dash('車輛資料')

max_length = 20
次 = deque(maxlen=max_length) oil_temps
= deque (maxlen=max_length) Intake_temps = deque(maxlen=max_length) Coolant_temps = deque(maxlen=max_length ) rpms = dequebdem =_lenqueng ( ) ) throttle_pos = 雙端佇列(maxlen=max_length)




data_dict = {“機油溫度”:oil_temps,
“進氣溫度”:intake_temps,
“冷卻液溫度”:coolant_temps,
“RPM”:rpms,
“速度”:speeds,
“節氣門位置”:throttle_pos}

def update_obd_values(時間,油溫,進氣溫度,冷卻劑溫度,轉速,速度,油門位置):

times.append(time.time())  
if len(times) == 1:  
    #starting relevant values  
    oil_temps.append(random.randrange(180,230))  
    intake_temps.append(random.randrange(95,115))  
    coolant_temps.append(random.randrange(170,220))  
    rpms.append(random.randrange(1000,9500))  
    speeds.append(random.randrange(30,140))  
    throttle_pos.append(random.randrange(10,90))  
else:  
    for data_of_interest in [oil_temps, intake_temps, coolant_temps, rpms, speeds, throttle_pos]:  
        data_of_interest.append(data_of_interest[-1]+data_of_interest[-1]*random.uniform(-0.0001,0.0001))  

return times, oil_temps, intake_temps, coolant_temps, rpms, speeds, throttle_pos  

次數、oil_temps、進氣_temps、冷卻液_temps、轉速、速度、throttle_pos = update_obd_values(次數、oil_temps、進氣_temps、冷卻劑_temps、rpm、速度、throttle_pos)

app.layout = html.Div([
html.Div([
html.H2('車輛資料',
style={'float': '左',
}),
]),
dcc.Dropdown(id='車輛資料' -name',
options=[{'label': s, 'value': s}
for s in data_dict.keys()],
value=['冷卻液溫度','機油溫度','進氣溫度'] ,
multi =True
),
html.Div(children=html.Div(id='graphs'), className='row'),
dcc.Interval(
id='graph-up​​date',
Interval=100),
], className="容器",style={'width':'98%','margin-left':10,'margin-right':10,'max-width':50000})

@app.callback(
dash.dependency.Output('graphs','children'),
[dash.dependency.Input('車輛資料名稱',
'值'),dash.dependency.Input('graph-up date ', 'n_intervals')]
)






​= 2:
class_choice = 'col s12 m6 l6'
else:
class_choice = 'col s12'

for data_name in data_names:  

    data = go.Scatter(  
        x=list(times),  
        y=list(data_dict[data_name]),  
        name='Scatter',  
        fill="tozeroy",  
        fillcolor="#6897bb"  
        )  

    graphs.append(html.Div(dcc.Graph(  
        id=data_name,  
        animate=True,  
        figure={'data': [data],'layout' : go.Layout(xaxis=dict(range=[min(times),max(times)]),  
                                                    yaxis=dict(range=[min(data_dict[data_name]),max(data_dict[data_name])]),  
                                                    margin={'l':50,'r':1,'t':45,'b':1},  
                                                    title='{}'.format(data_name))}  
        ), className=class_choice))  

return graphs  

外部_css = ["https://cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0/css/materialize.min.css"]
對於 external_css 中的 css:
app.css.append_css({"external_url": css})

外部_js =
['https://cdnjs.cloudflare.com/ajax/libs/materialize/0.100.2/js/materialize.min.js']
對於external_js中的js:
app.scripts.append_script({'external_url': js})

如果姓名=='主要的':
app.run_server(調試=True)

相關內容