Skip to content

Commit 3895755

Browse files
committed
Clean table layout.
1 parent c308c12 commit 3895755

File tree

11 files changed

+145
-94
lines changed

11 files changed

+145
-94
lines changed

Pipfile.lock

Lines changed: 102 additions & 64 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44
![Python](https://img.shields.io/badge/Python-^3.8-blue.svg?logo=python&longCache=true&logoColor=white&colorB=5e81ac&style=flat-square&colorA=4c566a)
55
![Flask](https://img.shields.io/badge/Flask-1.1.2-blue.svg?longCache=true&logo=flask&style=flat-square&logoColor=white&colorB=5e81ac&colorA=4c566a)
66
![Flask-Assets](https://img.shields.io/badge/Flask--Assets-v2.0-blue.svg?longCache=true&logo=flask&style=flat-square&logoColor=white&colorB=5e81ac&colorA=4c566a)
7-
![Pandas](https://img.shields.io/badge/Pandas-v1.0.3-blue.svg?longCache=true&logo=python&longCache=true&style=flat-square&logoColor=white&colorB=5e81ac&colorA=4c566a)
8-
![Dash](https://img.shields.io/badge/Dash-v1.11.0-blue.svg?longCache=true&logo=python&longCache=true&style=flat-square&logoColor=white&colorB=5e81ac&colorA=4c566a)
9-
![Plotly](https://img.shields.io/badge/Plotly-v4.6.0-blue.svg?longCache=true&logo=python&longCache=true&style=flat-square&logoColor=white&colorB=5e81ac&colorA=4c566a)
7+
![Pandas](https://img.shields.io/badge/Pandas-v1.0.4-blue.svg?longCache=true&logo=python&longCache=true&style=flat-square&logoColor=white&colorB=5e81ac&colorA=4c566a)
8+
![Dash](https://img.shields.io/badge/Dash-v1.12.0-blue.svg?longCache=true&logo=python&longCache=true&style=flat-square&logoColor=white&colorB=5e81ac&colorA=4c566a)
9+
![Plotly](https://img.shields.io/badge/Plotly-v4.8.1-blue.svg?longCache=true&logo=python&longCache=true&style=flat-square&logoColor=white&colorB=5e81ac&colorA=4c566a)
1010
![GitHub Last Commit](https://img.shields.io/github/last-commit/google/skia.svg?style=flat-square&colorA=4c566a&colorB=a3be8c)
1111
[![GitHub Issues](https://img.shields.io/github/issues/toddbirchard/plotlydash-flask-tutorial.svg?style=flat-square&colorA=4c566a&colorB=ebcb8b)](https://github.com/toddbirchard/plotlydash-flask-tutorial/issues)
1212
[![GitHub Stars](https://img.shields.io/github/stars/toddbirchard/plotlydash-flask-tutorial.svg?style=flat-square&colorB=ebcb8b&colorA=4c566a)](https://github.com/toddbirchard/plotlydash-flask-tutorial/stargazers)

application/assets.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
"""Compile stylesheets abd static assets."""
12
from flask_assets import Environment, Bundle
23

34

@@ -6,9 +7,11 @@ def compile_assets(app):
67
assets = Environment(app)
78
Environment.auto_build = True
89
Environment.debug = False
9-
less_bundle = Bundle('less/*.less',
10-
filters='less,cssmin',
11-
output='dist/css/styles.css',
12-
extra={'rel': 'stylesheet/less'})
10+
less_bundle = Bundle(
11+
'less/*.less',
12+
filters='less,cssmin',
13+
output='dist/css/styles.css',
14+
extra={'rel': 'stylesheet/less'}
15+
)
1316
assets.register('less_all', less_bundle)
1417
less_bundle.build(force=True)

application/plotlydash/dashboard.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@ def create_dashboard(server):
1717
)
1818

1919
# Prepare a DataFrame
20-
df = pd.read_csv('data/311-calls.csv', parse_dates=['created_date'])
20+
df = pd.read_csv('data/311-calls.csv', parse_dates=['created'])
2121
num_complaints = df['complaint_type'].value_counts()
22-
to_remove = num_complaints[num_complaints <= 20].index
22+
to_remove = num_complaints[num_complaints <= 30].index
2323
df.replace(to_remove, np.nan, inplace=True)
2424

2525
# Custom HTML layout
@@ -34,7 +34,7 @@ def create_dashboard(server):
3434
{
3535
'x': df['complaint_type'],
3636
'text': df['complaint_type'],
37-
'customdata': df['unique_key'],
37+
'customdata': df['key'],
3838
'name': '311 Calls by region.',
3939
'type': 'histogram'
4040
}

application/routes.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,9 @@
66
@app.route('/')
77
def home():
88
"""Landing page."""
9-
return render_template('index.jinja2',
10-
title='Plotly Dash & Flask Tutorial',
11-
template='home-template',
12-
body="This is a homepage served with Flask.")
9+
return render_template(
10+
'index.jinja2',
11+
title='Plotly Dash & Flask Tutorial',
12+
template='home-template',
13+
body="This is a homepage served with Flask."
14+
)

0 commit comments

Comments
 (0)