Last active
August 3, 2018 01:40
-
-
Save avinash-mishra/5d289bafff3b581a87c32aece50cab00 to your computer and use it in GitHub Desktop.
Revisions
-
avinash-mishra revised this gist
Aug 3, 2018 . 1 changed file with 4 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,3 +1,7 @@ """ Install dependencies before running : https://dash.plot.ly/installation """ import dash from dash.dependencies import Input, Output import dash_core_components as dcc -
avinash-mishra renamed this gist
Aug 3, 2018 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes. -
avinash-mishra created this gist
Aug 3, 2018 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,46 @@ import dash from dash.dependencies import Input, Output import dash_core_components as dcc import dash_html_components as html import pandas as pd pd.core.common.is_list_like = pd.api.types.is_list_like from pandas_datareader import data as web from datetime import datetime as dt app = dash.Dash('Hello World') app.layout = html.Div([ dcc.Dropdown( id='my-dropdown', options=[ {'label': 'Coke', 'value': 'COKE'}, {'label': 'Tesla', 'value': 'TSLA'}, {'label': 'Apple', 'value': 'AAPL'} ], value='COKE' ), dcc.Graph(id='my-graph') ], style={'width': '500'}) @app.callback(Output('my-graph', 'figure'), [Input('my-dropdown', 'value')]) def update_graph(selected_dropdown_value): df = web.DataReader( selected_dropdown_value, 'google', dt(2017, 1, 1), dt.now() ) return { 'data': [{ 'x': df.index, 'y': df.Close }], 'layout': {'margin': {'l': 40, 'r': 0, 't': 20, 'b': 30}} } app.css.append_css({'external_url': 'https://codepen.io/chriddyp/pen/bWLwgP.css'}) if __name__ == '__main__': app.run_server()