-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
fliu2
committed
Aug 9, 2017
1 parent
8ad8fa2
commit 0e4bfbd
Showing
10 changed files
with
166 additions
and
145 deletions.
There are no files selected for viewing
This file contains 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 characters
This file contains 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 characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,104 @@ | ||
import dash | ||
from dash.dependencies import Input,Output | ||
import dash_core_components as dcc | ||
import dash_html_components as html | ||
import plotly.graph_objs as go | ||
import pandas as pd | ||
import pymongo | ||
import seed | ||
|
||
db=seed.db | ||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
df=pd.DataFrame(db.queryValLog({})) | ||
|
||
|
||
|
||
|
||
print df.columns.values.tolist() | ||
|
||
print df.groupby('studyID') | ||
|
||
|
||
print df.studyID.unique() | ||
|
||
|
||
app=dash.Dash() | ||
|
||
|
||
|
||
|
||
|
||
app.layout=html.Div(children=[ | ||
html.H1(children="hello dash"), | ||
|
||
html.Div(children=''' | ||
Dash: a Weba pplication framework for python | ||
'''), | ||
|
||
dcc.Input(id='my-id', value='initial value', type="text"), | ||
html.P(), | ||
|
||
html.Div(id='my-div'), | ||
|
||
|
||
##for date visuzlaiton, server side rendering# | ||
## html.Img(id='my-img',src="data:image/gif;base64,R0lGODlhEAAQAMQAAORHHOVSKudfOulrSOp3WOyDZu6QdvCchPGolfO0o/XBs/fNwfjZ0frl3/zy7////wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACH5BAkAABAALAAAAAAQABAAAAVVICSOZGlCQAosJ6mu7fiyZeKqNKToQGDsM8hBADgUXoGAiqhSvp5QAnQKGIgUhwFUYLCVDFCrKUE1lBavAViFIDlTImbKC5Gm2hB0SlBCBMQiB0UjIQA7"), | ||
|
||
|
||
html.P(children="SelecViz"), | ||
|
||
dcc.Dropdown( | ||
options=[ | ||
{'label': 'New York City', 'value': 'NYC'}, | ||
{'label': u'Montreal', 'value': 'MTL'}, | ||
{'label': 'San Francisco', 'value': 'SF'} | ||
], | ||
value='MTL', | ||
multi=True | ||
|
||
), | ||
|
||
dcc.Graph(id='example-graph', | ||
figure={ | ||
'data':[ | ||
go.Scatter( | ||
x=df[df['studyID'] == i]['epoch'], | ||
y=df[df['studyID'] == i]['acc'], | ||
text=df[df['studyID'] == i]['time'], | ||
mode='markers', | ||
opacity=0.7, | ||
marker={ | ||
'size': 10, | ||
'line': {'width': 0.5, 'color': 'white'} | ||
}, | ||
name=i | ||
) for i in df.studyID.unique() | ||
], | ||
'layout':{ | ||
'title':'Dash visulization' | ||
} | ||
|
||
|
||
} | ||
|
||
) | ||
|
||
]) | ||
|
||
|
||
@app.callback( | ||
Output(component_id='my-div', component_property='children'), | ||
[Input(component_id='my-id', component_property='value')] | ||
) | ||
def update_output_div(input_value): | ||
print "server call back" | ||
return "{}".format(input_value) | ||
|
||
if __name__ =='__main__': | ||
app.run_server(debug=True) |
Empty file.
This file contains 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 characters
This file contains 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 characters
This file contains 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 characters
This file contains 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 characters
This file contains 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 characters
Oops, something went wrong.