-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.py
More file actions
123 lines (106 loc) · 3.3 KB
/
Copy pathapp.py
File metadata and controls
123 lines (106 loc) · 3.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
import plotly.plotly as py
import dash
import dash_html_components as html
import dash_core_components as dcc
import pandas as pd
import plotly.graph_objs as go
url = 'https://raw.githubusercontent.com/milaroisin/plotlyDashOS/master/dataset/plotlyoperatingsystems.csv'
os_data = pd.read_csv(url)
##data: MacOSX - 9, Windows - 4, Debian - 2, Other - 0
app = dash.Dash()
app.title = 'Dash App: Operating Systems - Interns'
## css elements for grid alignment
app.css.append_css({'external_url': 'https://codepen.io/amyoshino/pen/jzXypZ.css'})
app.layout = html.Div(
### Tabs
dcc.Graph(
id='piechart',
figure={
'data': [{'labels': ['MacOSX', 'Windows', 'Linux', 'Other'],
'values': [60, 26.7, 13.3, 0],
'sort': False,
'showLegend': False,
'text-info': 'percent-label',
'sort': False,
'marker': {
'colors': ['#e6f2ff', '#99ccff', '#ccccff',
'#cc99ff']},
'type': 'pie',
'hole': 0.8,
}],
'layout': {
'title': 'Plot.ly: Summer 2019 Interns Preferred Operating Systems',
'hoverinfo': 'label+percent+name',
'xaxis': dict(
title='Operating Systems',
titlefont=dict(
family='Old Standard TT',
size=20)),
'yaxis': dict(
title='# of Interns',
titlefont=dict(
family='Old Standard TT',
size=20)),
'annotations': [{
'text': 'PLOT.LY',
'font': {'size': 20
}}]
}
}
)
)
##Barchart
"""dcc.Graph(
id='barchart',
figure={
'data': [
{'x': ['MacOSX', 'Windows', 'Linux', 'Other'],
'y': [9, 4, 2, 0], 'type': 'bar'}],
'layout': {
'title': 'Plot.ly: Summer 2019 Preferred Operating Systems',
'xaxis': dict(
title='Operating Systems',
titlefont=dict(
family='Old Standard TT',
size=20
)),
'yaxis': dict(
title='# of Interns',
titlefont=dict(
family='Old Standard TT',
size=20
))
}
}
)
)
##LineChart
dcc.Graph(
id='line',
figure={
'data': [
{'x': ['MacOSX', 'Windows', 'Linux', 'Other'],
'y': [9, 4, 2, 0], 'type': 'line'}],
'layout': {
'title': 'Plot.ly: Summer 2019 Preferred Operating Systems',
'xaxis': dict(
title='Operating Systems',
titlefont=dict(
family='Old Standard TT',
size=20
)),
'yaxis': dict(
title='# of Interns',
titlefont=dict(
family='Old Standard TT',
size=20
))
}
}
)
)
"""
## return event statement
if __name__ == '__main__':
app.run_server(debug=True)
##end