Reader small image

You're reading from  Interactive Dashboards and Data Apps with Plotly and Dash

Product typeBook
Published inMay 2021
Reading LevelBeginner
PublisherPackt
ISBN-139781800568914
Edition1st Edition
Languages
Tools
Right arrow
Author (1)
Elias Dabbas
Elias Dabbas
author image
Elias Dabbas

Elias Dabbas is an online marketing and data science practitioner. He produces open-source software for building dashboards, data apps, as well as software for online marketing, with a focus on SEO, SEM, crawling, and text analysis.
Read more about Elias Dabbas

Right arrow

Allowing users to add dynamic components to the app

Not only will users be able to add components to the app's layout, but the components' contents will also be dynamically generated. Take a look at Figure 10.6 for the simplest example that we will start with:

Figure 10.6 – An app allowing users to add components to the app's layout

Figure 10.6 – An app allowing users to add components to the app's layout

Although extremely simple, the charts in this app have different dynamic names, as you can see in the chart titles. This was based on the dynamic value of n_clicks, which changes on every click.

The amount of code required to generate this is similar to any simple app; there isn't much complexity involved. We just need to look at it with fresh eyes. Let's start by coding the layout, which will consist of two simple components:

  1. Create a button to trigger the addition of new charts:
    dbc.Button("Add Chart", id='button')
  2. Create an empty div, with its children attribute...
lock icon
The rest of the page is locked
Previous PageNext Page
You have been reading a chapter from
Interactive Dashboards and Data Apps with Plotly and Dash
Published in: May 2021Publisher: PacktISBN-13: 9781800568914

Author (1)

author image
Elias Dabbas

Elias Dabbas is an online marketing and data science practitioner. He produces open-source software for building dashboards, data apps, as well as software for online marketing, with a focus on SEO, SEM, crawling, and text analysis.
Read more about Elias Dabbas