From 43ec7e5ca86ba53115e56931d933ebc6849273bf Mon Sep 17 00:00:00 2001 From: walkews Date: Tue, 11 Jul 2017 17:03:08 -0500 Subject: [PATCH] added form --- src/pyDataVizDay.py | 13 +++- src/static/css/custom.css | 25 ++++++- src/static/reveal_from_markdown.html | 98 +++++++++++++++++++++++++ src/static/test_form.html | 104 +++++++++++++++++++++++++++ src/templates/data_form.html | 57 +++++++++++++++ src/templates/enthusiast.html | 6 ++ src/templates/investor.html | 5 ++ src/templates/layout.html | 3 + 8 files changed, 307 insertions(+), 4 deletions(-) create mode 100644 src/static/reveal_from_markdown.html create mode 100644 src/static/test_form.html create mode 100644 src/templates/data_form.html diff --git a/src/pyDataVizDay.py b/src/pyDataVizDay.py index dc75f5c..e55bc4d 100644 --- a/src/pyDataVizDay.py +++ b/src/pyDataVizDay.py @@ -41,12 +41,20 @@ parser.add_argument('color', help='"Color" or "Black and White"', required=False data = etl.Data() + +inputs = ['top', 'start_year', 'end_year'] +dropdowns = {'genre': data.genre.genres.dropna().drop_duplicates().values.tolist(), + 'country':data.movie.country.dropna().drop_duplicates().values.tolist(), + 'language':data.movie.language.dropna().drop_duplicates().values.tolist() + } + @app.route('/') def index(): return render_template('index.html', body='Hello') @app.route('/investor') def investor(): + form = render_template('data_form.html', dropdowns=dropdowns, inputs=inputs) top = 5 top_countries = (data.movie.groupby('country') .sum()['budget'].sort_values(ascending=False) @@ -61,7 +69,7 @@ def investor(): title=f'Budget Trend for top {top} countries', colors=pal.todays_outfit) - return render_template('investor.html', body=c3_plot) + return render_template('investor.html', body=form) @app.route('/enthusiast') def enthusiast(): @@ -69,7 +77,8 @@ def enthusiast(): @app.route('/slides') def slides(): - slide_body = render_template('slide_body.html') + + slide_body = render_template('slide_body.html', filters=filters) return render_template('slides.html', body=slide_body) @api.route('/keywords') diff --git a/src/static/css/custom.css b/src/static/css/custom.css index 1f1b683..c25ccdf 100644 --- a/src/static/css/custom.css +++ b/src/static/css/custom.css @@ -7,7 +7,28 @@ body{ font-weight:10; } -.chosen{ +.text_input{ height:75px; width:75%; -} \ No newline at end of file + max-width: 300px; +} + + .chosen{ + height:75px; + width:75%; + max-width: 300px; +} + +.col-sm-3{ + padding:5px; +} + +.row{ + padding:5px; +} + +.text_input{ + float:right; + height:30px; + width:70%; + } diff --git a/src/static/reveal_from_markdown.html b/src/static/reveal_from_markdown.html new file mode 100644 index 0000000..364af45 --- /dev/null +++ b/src/static/reveal_from_markdown.html @@ -0,0 +1,98 @@ + + + + + + + reveal.js – The HTML Presentation Framework + + + + + + + + + + + + + + + + + + + + +
+ + +
+ +
+ +
+ + +
+ +
+ + + + + + + + diff --git a/src/static/test_form.html b/src/static/test_form.html new file mode 100644 index 0000000..c80ff45 --- /dev/null +++ b/src/static/test_form.html @@ -0,0 +1,104 @@ + + + + {% block head %} + {% block title %}{% endblock %} - pyDataVizDay + + + + + + + + + + + + + {% endblock %} + + + + + + + +
+
+
+ items: + +
+
+ items: + +
+
+ items: + +
+
+
+
+

KPI: things.

+
+
+ 1 of 3 +
+
+ 1 of 3 +
+
+
+ +{{ body | safe }} + + + + + diff --git a/src/templates/data_form.html b/src/templates/data_form.html new file mode 100644 index 0000000..3265d82 --- /dev/null +++ b/src/templates/data_form.html @@ -0,0 +1,57 @@ + +

Filter

+
+
+ {% for input in inputs %} +
+ {{ input }}: +
+ {% endfor %} +
+
+ {% for dropdown in dropdowns %} +
+ {{ dropdown }}: + +
+ {% endfor %} +
+
+ + +
+ + \ No newline at end of file diff --git a/src/templates/enthusiast.html b/src/templates/enthusiast.html index 5269771..25824d0 100644 --- a/src/templates/enthusiast.html +++ b/src/templates/enthusiast.html @@ -4,7 +4,13 @@ {% block head %} {{ super() }} + + + + + + {% endblock %} \ No newline at end of file diff --git a/src/templates/investor.html b/src/templates/investor.html index 007b483..d365432 100644 --- a/src/templates/investor.html +++ b/src/templates/investor.html @@ -4,7 +4,12 @@ {% block head %} {{ super() }} + + + + + {% endblock %} \ No newline at end of file diff --git a/src/templates/layout.html b/src/templates/layout.html index a7868b3..ecda501 100644 --- a/src/templates/layout.html +++ b/src/templates/layout.html @@ -10,6 +10,9 @@ + + + {% endblock %}