本文整理匯總了Python中dash_core_components.Graph方法的典型用法代碼示例。如果您正苦於以下問題:Python dash_core_components.Graph方法的具體用法?Python dash_core_components.Graph怎麽用?Python dash_core_components.Graph使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類dash_core_components
的用法示例。
在下文中一共展示了dash_core_components.Graph方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: display_graphs
# 需要導入模塊: import dash_core_components [as 別名]
# 或者: from dash_core_components import Graph [as 別名]
def display_graphs(n_clicks):
graphs = []
for i in range(n_clicks):
graphs.append(dcc.Graph(
id='graph-{}'.format(i),
figure={
'data': [{
'x': [1, 2, 3],
'y': [3, 1, 2]
}],
'layout': {
'title': 'Graph {}'.format(i)
}
}
))
return html.Div(graphs)
示例2: update_output
# 需要導入模塊: import dash_core_components [as 別名]
# 或者: from dash_core_components import Graph [as 別名]
def update_output():
fig = dcc.Graph(
id='example',
figure={
'data': [{
'y': [1, 5, 3],
'type': 'bar'
}]
}
)
fig2 = dcc.Graph(
id='example-1',
figure={
'data': [{
'y': [1, 5, 3],
'type': 'bar'
}]
}
)
return [fig, fig2]
示例3: prepare_send
# 需要導入模塊: import dash_core_components [as 別名]
# 或者: from dash_core_components import Graph [as 別名]
def prepare_send():
lCache = []
cData = get_All_data()
for pair in PAIRS:
ticker = pair.ticker
exchange = pair.exchange
graph = 'live-graph-' + exchange + "-" + ticker
lCache.append(html.Br())
if (pair.Dataprepared):
lCache.append(dcc.Graph(
id=graph,
figure=cData[exchange + ticker]
))
else:
lCache.append(html.Div(id=graph))
return lCache
# links up the chart creation to the interval for an auto-refresh
# creates one callback per currency pairing; easy to replicate / add new pairs
示例4: update_clustergram
# 需要導入模塊: import dash_core_components [as 別名]
# 或者: from dash_core_components import Graph [as 別名]
def update_clustergram(rows):
if len(rows) < 2:
return "Please select at least two rows to display."
return dcc.Graph(figure=dashbio.Clustergram(
data=df.loc[rows].values,
column_labels=columns,
row_labels=rows,
color_threshold={
'row': 250,
'col': 700
},
hidden_labels='row',
height=800,
width=700
))
示例5: generate_liveOut_layout
# 需要導入模塊: import dash_core_components [as 別名]
# 或者: from dash_core_components import Graph [as 別名]
def generate_liveOut_layout():
'Generate the layout per-app, generating each tine a new uuid for the state_uid argument'
return html.Div([
dpd.Pipe(id="named_count_pipe",
value=None,
label="named_counts",
channel_name="live_button_counter"),
html.Div(id="internal_state",
children="No state has been computed yet",
style={'display':'none'}),
dcc.Graph(id="timeseries_plot"),
dcc.Input(value=str(uuid.uuid4()),
id="state_uid",
style={'display':'none'},
)
])
示例6: update_server_information
# 需要導入模塊: import dash_core_components [as 別名]
# 或者: from dash_core_components import Graph [as 別名]
def update_server_information(status):
config = current_app.config["FRACTAL_CONFIG"]
server = dcc.Markdown(
f"""
**Name:** {config.fractal.name}
**Query Limit:** {config.fractal.query_limit}
"""
)
database = dcc.Markdown(
f"""
**Name:** {config.database.database_name}
**Port:** {config.database.port}
**Host:** {config.database.host}
"""
)
queue = dcc.Graph(figure=task_graph())
return server, database, queue
示例7: __init__
# 需要導入模塊: import dash_core_components [as 別名]
# 或者: from dash_core_components import Graph [as 別名]
def __init__(self, parent_name, local_name):
Component.__init__(self, parent_name, local_name)
self._register(
dcc.Graph(id=self.full_name,
figure={
'data': [],
'layout': make_layout(None, None, None, None)
}))
示例8: get_account_stats_figure
# 需要導入模塊: import dash_core_components [as 別名]
# 或者: from dash_core_components import Graph [as 別名]
def get_account_stats_figure(account_stats_reader: AccountStatsReader):
graph_list = []
# 賬戶統計曲線
if account_stats_reader:
fig = account_stats_reader.draw_line(show=False)
for trader_name in account_stats_reader.trader_names:
graph_list.append(dcc.Graph(
id='{}-account'.format(trader_name),
figure=fig))
return graph_list
示例9: update_target_signals
# 需要導入模塊: import dash_core_components [as 別名]
# 或者: from dash_core_components import Graph [as 別名]
def update_target_signals(entity_id, start_date, end_date, trader_index):
if entity_id and (trader_index is not None):
return dcc.Graph(
id=f'{entity_id}-signals',
figure=get_trading_signals_figure(order_reader=order_readers[trader_index], entity_id=entity_id,
start_timestamp=start_date, end_timestamp=end_date))
raise dash.exceptions.PreventUpdate()
示例10: update_graph
# 需要導入模塊: import dash_core_components [as 別名]
# 或者: from dash_core_components import Graph [as 別名]
def update_graph(dropdown_value):
return {
'layout': {
'title': 'Graph of {}'.format(dropdown_value),
'margin': {
'l': 20,
'b': 20,
'r': 10,
't': 60
}
},
'data': [{'x': [1, 2, 3], 'y': [4, 1, 2]}]
}
示例11: updateContent
# 需要導入模塊: import dash_core_components [as 別名]
# 或者: from dash_core_components import Graph [as 別名]
def updateContent(hoverData1, hoverData2):
print(hoverData1)
print(hoverData2)
if hoverData1 is not None:
return html.Div([
html.Div('Graph 1'),
html.Pre(hoverData1)
])
if hoverData2 is not None:
return html.Div([
html.Div('Graph 2'),
html.Pre(hoverData1)
])
示例12: plot_bar
# 需要導入模塊: import dash_core_components [as 別名]
# 或者: from dash_core_components import Graph [as 別名]
def plot_bar(data):
app.layout = html.Div(children=[html.H1(children='CM PT'), html.Div(children='''History.'''),
dcc.Graph(
figure=go.Figure(
data = data,
layout=go.Layout(title='Streams', showlegend=False, barmode='stack', margin=go.Margin(l=200, r=0, t=40, b=20))),
style={'height': 300},
id='my-graph')
])
示例13: display_content
# 需要導入模塊: import dash_core_components [as 別名]
# 或者: from dash_core_components import Graph [as 別名]
def display_content(selected_tab):
return html.Div([
html.H1(selected_tab),
dcc.Graph(id='graph', figure=generate_figure(selected_tab))
])
示例14: InteractiveImage
# 需要導入模塊: import dash_core_components [as 別名]
# 或者: from dash_core_components import Graph [as 別名]
def InteractiveImage(id, image_path):
encoded_image = base64.b64encode(open(image_path, 'rb').read())
return dcc.Graph(
id=id,
figure={
'data': [],
'layout': {
'xaxis': {
'range': RANGE
},
'yaxis': {
'range': RANGE,
'scaleanchor': 'x',
'scaleratio': 1
},
'height': 600,
'images': [{
'xref': 'x',
'yref': 'y',
'x': RANGE[0],
'y': RANGE[1],
'sizex': RANGE[1] - RANGE[0],
'sizey': RANGE[1] - RANGE[0],
'sizing': 'stretch',
'layer': 'below',
'source': 'data:image/png;base64,{}'.format(encoded_image)
}],
'dragmode': 'select' # or 'lasso'
}
}
)
示例15: update_graph
# 需要導入模塊: import dash_core_components [as 別名]
# 或者: from dash_core_components import Graph [as 別名]
def update_graph(hoverData):
if not hoverData:
x_value=x_data[250]
opacity = 0
else:
x_value = hoverData['points'][0]['x']
opacity = 0.8
data = [go.Scatter(
x=x_data,
y=y_data,
line={'color': '#235ebc'},
opacity=0.8,
name="Graph"
),
go.Scatter(
x=[x_value, x_value],
y=[0, height],
line={'color': '#a39999'},
opacity=opacity,
name='Moving Line')
]
layout = go.Layout(
xaxis={'type': 'linear', 'title': "Timestep"},
yaxis={'type': 'linear', 'title': "Value"},
margin={'l': 60, 'b': 40, 'r': 10, 't': 10},
hovermode="False"
)
return {'data': data, 'layout': layout}