Skip to content

Commit

Permalink
Move print button and add callback for baseline description
Browse files Browse the repository at this point in the history
  • Loading branch information
chmnata committed Dec 10, 2019
1 parent cc1de40 commit cc6a5cf
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions app.py
Original file line number Diff line number Diff line change
Expand Up @@ -685,8 +685,10 @@ def generate_figure(street, direction, day_type='Weekday', period='AMPK',
html.Span("Selected ", style={'display':'inline-block', 'margin-left':"10px"})])

STREETS_LAYOUT = html.Div(children=[
html.Div(html.Button(id=CONTROLS['toggle'], children='Show Filters'), className="hide-on-print"),
html.Div(dbc.Button("Generate PDF", id='print-button')),
html.Div(children=[
html.Button(id=CONTROLS['toggle'], children='Show Filters'),
html.Button("Generate PDF", id='print-button')]
, className="hide-on-print"),
html.Div(
id=CONTROLS['div_id'],
children=[
Expand Down Expand Up @@ -796,7 +798,8 @@ def generate_figure(street, direction, day_type='Weekday', period='AMPK',
html.H2(id=STREETNAME_DIV[1], style={'fontSize':20}),
html.Div(id = GRAPHDIVS[1], children=dcc.Graph(id=GRAPHS[1])),
html.Div(children=[LEGEND]),
html.H3('Baseline date range for all segment except whatever and whatever is September 1,2019 to October 12, 2019')
html.H3(id = 'baseline-description', children=
'All routes have the baseline of September 1,2019 to October 12, 2019 except for TTC trackwork at Kingston/Woodbine and Queen with a baseline of August 1, 2019 to September 7, 2019.')
]), width={"size":8, "order":2}, sm=12, xs=12, md=12, lg=8),

],className="reverse-stack"),
Expand Down Expand Up @@ -832,6 +835,15 @@ def display_streets(value):
else:
return {'display':'none'}

@app.callback(Output('baseline-description', 'style'),
[Input("baseline-toggle", 'value')],)
def display_baseline(value):
'''If baseline is clicked then display baseline description'''
if value == 1:
return {'display':'inline'}
else:
return {'display':'none'}

@app.callback(Output(CONTROLS['div_id'], 'style'),
[Input(CONTROLS['toggle'], 'n_clicks')],
state=[State(CONTROLS['toggle'], 'children')]
Expand Down

1 comment on commit cc6a5cf

@chmnata
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#61

Please sign in to comment.