Python Dash Application Home page, is a K-line map to do Damo, but the data source used by Google, not to go. Of course, you can change Yahoo, but after all, the domestic is still more cordial.
The official demo with the Pandas_datareader to get data, first need to change a can get domestic data, looked at the next tushare very useful.
In addition, refer to flask, change host to 0.0.0.0, so it is not limited to 127.0.0.1来 access. Of course, the port can also be replaced if needed.
#-*-Coding:utf-8-*-"" "Created on Sun Mar one 10:16:43 2018@author:administrator" "" Import Dashfrom Dash.dependencies im Port Input, Outputimport dash_core_components as DCC import dash_html_components as Htmlfrom datetime import datetime as D T import tushare as TS app = Dash. Dash () App.layout = html. DIV ([HTML. H1 (' k-30 '), DCC. Dropdown (id= ' My-dropdown ', options=[{' label ': ' Ekodi ', ' value ': ' 600933 '}, {' label ': ' Gan Feng li industry ', ' value ': ' 002460 '}, {' label ': ' China Shenhua ', ' value ': ' 601088 '}, {' label ': ' GAC group ', ' value ': ' 601238 '}, {' label ': ' Spring air ', ' value ': ' 601021 '},], value= ' 600933 '), DCC. Graph (id= ' my-graph ')]) @app. Callback (Output (' my-graph ', ' figure '), [Input (' My-dropdown ', ' value ')] def update_graph (selected_dropdown_value): # df = web. DataReader (# selected_dropdown_value, data_source= ' Yahoo ', # START=DT (2018, 1, 1), End=dt.now () #) d f = Ts.get_k_data (Selected_dropdown_value, ktype= ' 30') return {' data ': [{' X ': Df.index, ' y ':d f.close}]}if __name__ = = ' __main__ ': App.run_server (host= "0.0.0.0")
Python Advanced Data Visualization Dash2