Quantcast
Channel: 🎛️ Dash - Plotly Community Forum
Viewing all articles
Browse latest Browse all 6271

How to display multi dash in the same page, but in diferents locations?

$
0
0

@deyvison wrote:

Hello Guys,
I would like to display more than 1 dash in the same page, but in different places of the page.
In the simple example below, I can plot my app.layout after My Custom header div , how can I plot my app.layout2 in the same page but after My Custom footer div?

  • I tried to create another app, but it didn’t work.
  • URLs will display the second dash in other page. Therefore, it doesn’t work for me
  • If I put a second {%app_entry%}, it doesnt work.
# -*- coding: utf-8 -*-

import dash

import dash_core_components as dcc

import dash_html_components as html

external_stylesheets = ['https://codepen.io/chriddyp/pen/bWLwgP.css']

app = dash.Dash(__name__, external_stylesheets=external_stylesheets)

app.index_string = '''

<!DOCTYPE html>

<html>

    <head>

        {%metas%}

        <title>{%title%}</title>

        {%favicon%}

        {%css%}

    </head>

    <body>

        <div>My Custom header</div>

        {%app_entry%}

        <footer>

            {%config%}

            {%scripts%}

            {%renderer%}

        </footer>

        <div>My Custom footer</div>

        -----------------> I WOULD LIKE MY SECOND DASH HERE  <---------------

    </body>

</html>

'''

app.layout = html.Div(children=[

    html.H1(children='Hello Dash'),

    html.Div(children='''

        Dash: A web application framework for Python.

    '''),

    dcc.Graph(

        id='example-graph',

        figure={

            'data': [

                {'x': [1, 2, 3], 'y': [4, 1, 2], 'type': 'bar', 'name': 'SF'},

                {'x': [1, 2, 3], 'y': [2, 4, 5], 'type': 'bar', 'name': u'Montréal'},

            ],

            'layout': {

                'title': 'Dash Data Visualization'

            }

        }

    )

])

app.layout2 = html.Div('SECOND LAYOUT HEREEEE')

if __name__ == '__main__':

    app.run_server(debug=True)

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 6271

Trending Articles