-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
65 lines (54 loc) · 1.64 KB
/
main.py
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
import dash
import dash_core_components as dcc
import dash_html_components as html
import pandas as pd
from dash.dependencies import Input, Output
import plotly.graph_objs as go
import sqlite3
conn = sqlite3.connect("twitter.db")
c = conn.cursor()
def create_table():
c.execute("CREATE TABLE IF NOT EXISTS Twitter")
app = dash.Dash(__name__)
colors = {
'background': '#111333',
'text': '#7FDBFF'
}
df = pd.read_csv('https://raw.githubusercontent.com/plotly/datasets/master/2014_usa_states.csv')
app.layout = html.Div(style={'backgroundColor': colors['background']}, children=[
dcc.Graph(
id='example_graph',
figure={
'data': [
{'x': [1, 2, 3], 'y': [3, 6, 9], 'type': 'bar', 'name': 'example'}
],
'layout': {
'plot_bgcolor': colors['background'],
'paper_bgcolor': colors['background'],
'font': {
'color': colors['text']
},
'title': 'Dash Data Visualization'
}
}
),
dcc.Graph(
id='example_graph2',
figure={
'data': [go.Table(
header=dict(values=list(df.columns),
line=dict(color='#7D7F80'),
fill=dict(color='#a1c3d1')),
cells=dict(values=[df[column] for column in df.columns]),
)],
'layout': {
'title': 'Example - 2'
}
}
)
])
# @app.callback(Output(),)
# def update_graph():
# data = pd.read_sql("SELECT * FROM Twitter", conn)
if __name__ == '__main__':
app.run_server()