Uh oh!
There was an error while loading. Please reload this page.
Conversation
chriddyp
commented
Sep 14, 2017
chriddyp
commented
Sep 14, 2017
Fixes plotly/dash#36 |
chriddyp
commented
Sep 14, 2017
Try it out on the pre-release channel with That example above: importdashfromdash.dependenciesimportInput, Outputimportdash_core_componentsasdccimportdash_html_componentsashtmlfromloremipsumimportget_sentencesapp=dash.Dash()
app.scripts.config.serve_locally=Trueapp.layout=html.Div([
dcc.Tabs(
tabs=[
{'label': 'Tab {}'.format(i), 'value': i} foriinrange(1, 5)
],
value=3,
id='tabs'
),
html.Div(id='tab-output')
], style={
'width': '80%',
'fontFamily': 'Sans-Serif',
'margin-left': 'auto',
'margin-right': 'auto'
})
@app.callback(Output('tab-output', 'children'), [Input('tabs', 'value')])defdisplay_content(value):
data= [
{
'x': [1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003,
2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012],
'y': [219, 146, 112, 127, 124, 180, 236, 207, 236, 263,
350, 430, 474, 526, 488, 537, 500, 439],
'name': 'Rest of world',
'marker': {
'color': 'rgb(55, 83, 109)'
},
'type': ['bar', 'scatter', 'box'][int(value) %3]
},
{
'x': [1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003,
2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012],
'y': [16, 13, 10, 11, 28, 37, 43, 55, 56, 88, 105, 156, 270,
299, 340, 403, 549, 499],
'name': 'China',
'marker': {
'color': 'rgb(26, 118, 255)'
},
'type': ['bar', 'scatter', 'box'][int(value) %3]
}
]
returnhtml.Div([
dcc.Graph(
id='graph',
figure={
'data': data,
'layout': {
'margin': {
'l': 30,
'r': 0,
'b': 30,
't': 0
},
'legend': {'x': 0, 'y': 1}
}
}
),
html.Div(' '.join(get_sentences(10)))
])
if__name__=='__main__':
app.run_server(debug=True) |
chriddyp
commented
Sep 15, 2017
TheoLvs
commented
Sep 15, 2017
Awesome ! Thank you very much |
richard-muir
commented
Sep 15, 2017
Hey Chris, looking great! Tabs & Upload have taken Dash to the next level! How did you get the tabs on the left-hand side? Had a look through the source, but struggling to figure it out. |
chriddyp
commented
Sep 15, 2017
@richard-muir Sorry about that! I forgot to publish my latest commits. importdashfromdash.dependenciesimportInput, Outputimportdash_core_componentsasdccimportdash_html_componentsashtmlfromloremipsumimportget_sentencesapp=dash.Dash()
app.scripts.config.serve_locally=Truevertical=Trueifnotvertical:
app.layout=html.Div([
dcc.Tabs(
tabs=[
{'label': 'Market Value', 'value': 1},
{'label': 'Usage Over Time', 'value': 2},
{'label': 'Predictions', 'value': 3},
{'label': 'Target Pricing', 'value': 4},
],
value=3,
id='tabs',
vertical=vertical
),
html.Div(id='tab-output')
], style={
'width': '80%',
'fontFamily': 'Sans-Serif',
'margin-left': 'auto',
'margin-right': 'auto'
})
else:
app.layout=html.Div([
html.Div(
dcc.Tabs(
tabs=[
{'label': 'Market Value', 'value': 1},
{'label': 'Usage Over Time', 'value': 2},
{'label': 'Predictions', 'value': 3},
{'label': 'Target Pricing', 'value': 4},
],
value=3,
id='tabs',
vertical=vertical,
style={
'height': '100vh',
'borderRight': 'thin lightgrey solid',
'textAlign': 'left'
}
),
style={'width': '20%', 'float': 'left'}
),
html.Div(
html.Div(id='tab-output'),
style={'width': '80%', 'float': 'right'}
)
], style={
'fontFamily': 'Sans-Serif',
'margin-left': 'auto',
'margin-right': 'auto',
})
@app.callback(Output('tab-output', 'children'), [Input('tabs', 'value')])defdisplay_content(value):
data= [
{
'x': [1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003,
2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012],
'y': [219, 146, 112, 127, 124, 180, 236, 207, 236, 263,
350, 430, 474, 526, 488, 537, 500, 439],
'name': 'Rest of world',
'marker': {
'color': 'rgb(55, 83, 109)'
},
'type': ['bar', 'scatter', 'box'][int(value) %3]
},
{
'x': [1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003,
2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012],
'y': [16, 13, 10, 11, 28, 37, 43, 55, 56, 88, 105, 156, 270,
299, 340, 403, 549, 499],
'name': 'China',
'marker': {
'color': 'rgb(26, 118, 255)'
},
'type': ['bar', 'scatter', 'box'][int(value) %3]
}
]
returnhtml.Div([
dcc.Graph(
id='graph',
figure={
'data': data,
'layout': {
'margin': {
'l': 30,
'r': 0,
'b': 30,
't': 0
},
'legend': {'x': 0, 'y': 1}
}
}
),
html.Div(' '.join(get_sentences(10)))
])
if__name__=='__main__':
app.run_server(debug=True) |
dotsdl
commented
Sep 19, 2017
Awesome @chriddyp! This is really going to make some incredible things possible with relatively little effort. |
chriddyp
commented
Sep 26, 2017
I have pushed |
* upload component 🎉 * integration test * update circle python requirements * lint * ✨ sort imports
chriddyp
commented
Nov 2, 2017
I have rebased this branch off of the latest version. Try this out with |
This looks awesome! However, is there a way to change the color of a tab? |
Hey, @chriddyp thank you very much. I am trying to actually get different data on each tab. I am quite new in Python, but so far I have tried the following. I would love if you could point where my error is. I have also tried to create another label, without success as it is apparent . |
chriddyp
commented
Nov 15, 2017
@jbrav - Would you mind asking this implementation question in the dash community forum? https://community.plot.ly/c/dash. That'll keep things a little bit more organized for me and you're likely to get more people to help you out there. Thanks! |
- Add newlines at end of file. - Add a .editorconfig for newlines at end of file.
chriddyp
commented
Feb 27, 2018
I've made a new prerelease off of master. Get the latest with: And check your version with: |
charleyferrari
commented
Mar 16, 2018
@chriddyp Do you think there's a way for Here's a toy example of what I'm thinking: Ideally I'd like a user to be able to make selections in each tab, and have the main output draw from both tabs. Something like this doesn't work now because the tabs change the layout, and it's impossible for both |
chriddyp
commented
Mar 16, 2018
@charleyferrari - All of the inputs of a callback need to be visible in the layout at the same time in order for them to fire the callback. You could keep them layout by just toggling the visibility, like: app.layout=html.Div([
dcc.Tabs(...),
dcc.Dropdown(id='dropdown1', style={'display': 'none'}, ...)
dcc.Dropdown(id='dropdown2', style={'display': 'none'}, ...)
])
@app.callback(Output('dropdown1', 'style'), [Input('tabs', 'value')])defupdate_dropdown(value):
return {'display': 'block'ifvalue==1else'none'}
@app.callback(Output('dropdown2', 'style'), [Input('tabs', 'value')])defupdate_dropdown(value):
return {'display': 'block'ifvalue==2else'none'} |
Forander
commented
Mar 26, 2018
Is there was a way to use Tabs offline? I would like to create an HTML dashboard with plots arranged in tabs which I can email to people who don't have Python installed (due to security requirements I also cannot use Dash server). This can be done using Bokeh but I would prefer using Plotly as it's much more user friendly. Any help would really be appreciated. Thanks |
chriddyp
commented
Mar 26, 2018
This is a separate issue than what is presented in this PR. In any case, this isn't possible now with Dash but it will be in the future. There is a WIP PR here: plotly/dash-renderer#7 |
Forander
commented
Mar 26, 2018
Thanks for the quick response Chris. What would you suggest if I'm looking to create something like this? Is it possible to arrange something myself by saving Plotly plots as divs? |
chriddyp
commented
Mar 26, 2018
Can you ask this in the community forum? https://community.plot.ly/c/dash. The discussion in this thread should be related to this PR. |
steremma
commented
Apr 12, 2018
This is an extremely useful PR, congrats @chriddyp ! Can we maybe have a (rough) estimation of when this could be merged? I am interested in using it for a client facing application so I would feel a lot better using master! |
Thanks for the great work. @chriddyp I encountered one problem when I tried to place an upload component (https://dash.plot.ly/dash-core-components/upload) inside a tab, it can not properly display the upload block. If I don't put the upload component (the same codes) in the tab, the upload block can properly display... Is this normal? |
ghost
commented
Apr 26, 2018
Hi Chris, |
@chriddyp for Tabs, it's not included in the latest release (0.22). I had to revert back to an older version 0.21.rc01 which means I can't use some other new cool features people added to dash-core-component. Can you please see if you can merge to the latest branch? Thanks. |
thomasmarshbintel
commented
May 8, 2018
If it can be merged that would be great since scattermapbox doesn't work with this branch and I love the tabs way too much. |
slash31
commented
May 12, 2018
+1 on having this re-integrated into the train. Thanks for all of your hard work! |
randiaz95
commented
May 26, 2018
Major firepower with this tab pre release, the programming gods are happy :). |
kyleabeauchamp
commented
Jun 15, 2018
I too am interested in seeing this PR updated for the latest release. |
chriddyp
commented
Jun 21, 2018
Thank you everyone so much for the reviews and feedback ❤️ We have incorporated this feedback into a new revision of the Tabs component here: #213. |
jogendraKhalsa
commented
Oct 8, 2018
Hi Chris, ... can you help with a situation wherein i have to update real time using dcc.Interval as component-Interval is not part of 0.21.0rcxx . |




No description provided.