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

Percentage height of dcc.Loading children

$
0
0

Hi,

When a dcc.Loading has finished loading, the style is empty which means that children cannot access the % values for their height attribute.

In the below example the graph is not the expected 5% height (although the width is 70% as expected).

Is this a bug or is it possible to set a % height for the graph in the below example?

import dash
import dash_core_components as dcc
import dash_html_components as html

app = dash.Dash()

app.layout = html.Div(
        dcc.Loading(
            dcc.Graph(
                id='graph',
                style={
                    'height': '5%',
                    'width': '70%'
                }
            )
        ),
        style={
            'height':'calc(100vh - 16px)',
            'width':'calc(100vw - 16px)'
        }
    )

app.run_server()

Versions:

  • dash 1.13.4
  • dcc 1.10.1
  • html 1.0.3

Thanks

1 post - 1 participant

Read full topic


Tips for speeding up dcc.Tabs on dash

$
0
0

Hello! I’ve really enjoyed using Dash, and have deployed an app to heroku.

https://ftacv-simulation.herokuapp.com/

It’s much slower than on my localhost, and I’m trying to find reasons why. I’ve switched to the webgl renderer, and have reduced the amount of data being plotted in some instances. My issue is now that switching between different graphs using dcc.Tabs is very slow relative to the app in my local host. I’m storing the output of various simulations in a dcc.Store element, but accessing them is still slow. Is there a way to speed this up, potentially by caching the data in the users browser?

2 posts - 2 participants

Read full topic

html.Button is not on app.callback's trigerred list

$
0
0

(topic withdrawn by author, will be automatically deleted in 24 hours unless flagged)

1 post - 1 participant

Read full topic

Is is possilble to get mouse/click position?

$
0
0

The goal
I use Python with plot.ly for plotting candlestick charts and I need a measuring tool for getting distance between 2 elements. Example:
Peek 2020-07-09 17-07
The lib doesn’t have such a tool so I tried to write it. My logic is - handle first mouse click on a chart, then handle all mouse moves and plot new line/box on the chart.

I tried:

  1. Get position with clickData and hoverData but it returns only clicked element. I can’t get an exact point, when I click on the candle it returns full candle’s data and I need just point. Also, the events will return nothing when I click outside of an element.
  2. Get mouse position with JavaScript. I’ve tried this example, it works but it returns the position of the mouse inside of browser window and it’s impossible to get data from the chart (price and date).

Also, I was reading about plot.ly plugins. Is it possible to create such a tool with plugin?

Thanks in advance :smiley:.

3 posts - 2 participants

Read full topic

Dash Layout example is erroring

$
0
0

I suspect this is due to the reference of New in dash 0.30.0 and dash-renderer 0.15.0 and I am using the latest Dash 1.13.4 but the first examples on https://dash.plotly.com/layout are failing with:

Traceback (most recent call last):
  File "/Users/steve/PycharmProjects/marketemp/dash999.py", line 16, in <module>
    fig = px.bar(df, x="x", y=["SF", "Montreal"], barmode="group")
  File "/Users/steve/PycharmProjects/marketemp/venv/lib/python3.7/site-packages/plotly/express/_chart_types.py", line 313, in bar
    layout_patch=dict(barmode=barmode),
  File "/Users/steve/PycharmProjects/marketemp/venv/lib/python3.7/site-packages/plotly/express/_core.py", line 1432, in make_figure
    args, constructor, trace_patch
  File "/Users/steve/PycharmProjects/marketemp/venv/lib/python3.7/site-packages/plotly/express/_core.py", line 1275, in infer_config
    args = build_dataframe(args, all_attrables, array_attrables)
  File "/Users/steve/PycharmProjects/marketemp/venv/lib/python3.7/site-packages/plotly/express/_core.py", line 1084, in build_dataframe
    % (field, len(argument), str(list(df_output.columns)), length)
ValueError: All arguments should have the same length. The length of argument `y` is 2, whereas the length of previous arguments ['x'] is 3

I am not sure why the length of y arguments (number of graph elements) and x arguments (number of points each y element is graphing) need to match. I would suggest that this example (or this error condition) needs a rev.

4 posts - 2 participants

Read full topic

Using dccGraph with ggplotly slow performance

$
0
0

I am using ggplot and ggplotly to make and render plots but it seems to be performing very slowly. For example,
this return statement: return(dccGraph(figure=ggplotly(plot1)) takes a very long time to render. Is there any alternative to this, perhaps another library that can speed up the performance of rendering this plot?

1 post - 1 participant

Read full topic

🐌 Smaller version of async-plotlyjs.js? it's so BIG and loads so slow

$
0
0

I’ve been troubleshooting a very slow app that I originally thought was slow because of my try at clustering
27k data points on a leaflet map. There are problems with the leaflet component - as is being discussed here - but I’ve noticed that I big factor is seemingly unrelated - loading of async-plotlyjs.js

Loading this 3.4MB behemoth takes usually between 6 and 10 seconds.

I’ve tried loading this in two different ways:

  1. via app = dash.Dash(__name__, serve_locally=False) which serves it from unpackage here
  2. via app = dash.Dash(__name__, serve_locally=True) which is Dash’s default configuration which serves it locally from \Lib\site-packages\dash_core_components\

The remote method seems to shave about 1 to 2 seconds off the local serve method. Even so, the quickest it ever gets takes more than 6 seconds.

The browser is mostly idle through all of this

As a result, it takes the rest of the page about that long to complete rendering. Is there any way to get a trimmed down version of this script? Or perhaps a way to make it non blocking?

You can see what I am talking about live at https://dash.scious.io/ Thanks in advance! :slight_smile:

2 posts - 2 participants

Read full topic

Gauge appears too small in my html.DIV


Tabulator Dash Component

$
0
0

Folks I found myself needing functionality from Tabulator (fantastic data table project) http://tabulator.info/

  • Grouping of rows under a header
  • Incase-sensitive searching
  • Custom filters

I found Tabulator had a react port, and went ahead and made a dash version, providing callbacks for updating data / columns, and handling row clicks.

It meets my current needs, and i’m learning as I’m going but it might be of use to others.
And willing to take input / requests if there’s a desire to add more tabulator functionality.

Details : https://github.com/preftech/dash-tabulator
Pypi: pip install dash_tabulator

2 posts - 2 participants

Read full topic

Filter DataTable from Input Value using Button

$
0
0

I have this app that uses pandas dataframe to show datatable.

I have input field and button. This is to be used to filter out the data.

However, I am keep running into this issue.

image

import dash
import dash_core_components as dcc
import dash_html_components as html
from dash.dependencies import Input, Output
import plotly.express as px
import dash_table
import dash_bootstrap_components as dbc
import pandas as pd

df = pd.read_csv('file.csv')
app = dash.Dash(external_stylesheets=[dbc.themes.BOOTSTRAP])

PLOTLY_LOGO = r"plotly-logomark.png"


search_bar = dbc.Row(
    [
        dbc.Col(
            dbc.Input(
                id='input_vid',
                type="search", 
                placeholder="Search"
            )),
        dbc.Col(
            dbc.Button(
                "Search",
                id="button_search_vid", 
                color="primary", 
                className="ml-2"),
            width="auto",
        ),
    ],
    no_gutters=True,
    className="ml-auto flex-nowrap mt-3 mt-md-0",
    align="center",
)

navbar = dbc.Navbar(
    [
        html.A(
            # Use row and col to control vertical alignment of logo / brand
            dbc.Row(
                [
                    dbc.Col(dbc.NavbarBrand("Unit Pedigree", className="ml-2")),
                ],
                align="center",
                no_gutters=True,
            ),
            href="#",
        ),
        dbc.NavbarToggler(id="navbar-toggler"),
        dbc.Collapse(search_bar, id="navbar-collapse", navbar=True),
    ],
    color="dark",
    dark=True,
)


app.layout =  html.Div([
    html.Div(
        navbar
    ),

    dbc.Container([
        html.Div(children='''
            Data Table
        '''),

        dash_table.DataTable(
            id='dt_pass_fail_summary',
            filter_action='native',
            sort_action="native",
            columns = [{'id': c, 'name': c} for c in df.columns],
            data = df.to_dict('records'),
            style_header={
                'backgroundColor': 'white',
                'fontWeight': 'bold'
            }
        )
    ])
]) 



@app.callback(
    [
        Output(component_id='dt_pass_fail_summary', component_property='data'),
        Output(component_id='dt_pass_fail_summary', component_property='columns')
    ],
    [
        Input(component_id='input_vid', component_property='value'),
        Input(component_id='button_search_vid', component_property='n_clicks')
    ]
)
def update_pass_fail_summary(value, n_clicks):
    
    if n_clicks!=None:
        df = pd.read_csv('file.csv')
        df_updated = df[df["Visual_ID"] == value]
        columns = [{'id': c, 'name': c} for c in df_updated.columns]
        data = df_updated.to_dict('records')
        return [data, columns]

if __name__ == '__main__':
    app.run_server(debug=True)

2 posts - 2 participants

Read full topic

How to run dash without a port

$
0
0

I plan to write a dash app on a remote server without allowing to open a new port due to security purpose. I wonder if I can somehow display dash app directly in Jupyter Notebook without a port or host it in my localhost port.

1 post - 1 participant

Read full topic

How to clear output of Div when user upload file?

$
0
0

Hi All,

I tried this beautiful library and created an application where I ask file(Image) from the user and then through my object detection model, I cropped and showed different things based on user options. Everything is working fine.

The problem that I am facing is for the first time the Div for Image output is empty and when someone uploads an Image it shows the desired result. But when I try to upload the second time the previous output is still on the screen.
How can I remove/clear the Div so that it is fresh as the first time?
Thanks

1 post - 1 participant

Read full topic

Difference between debug on and off

$
0
0

(topic withdrawn by author, will be automatically deleted in 24 hours unless flagged)

1 post - 1 participant

Read full topic

Southern Ocean wave buoy app

$
0
0

We have recently created some dashboard to display real-time ocean wave observations from some wave buoy deployed in the Southern Ocean (https://wavebuoy.oceanum.science/). Dash was a very handy framework to help building this app.

2 posts - 2 participants

Read full topic

Is there a way to "catch" that someone refreshed page?

$
0
0

As I wrote in topic - is there a way to catch that someone pressed F5? I need it to trigger the method.

2 posts - 2 participants

Read full topic


Plotly Annotated Heatmap Colorscale (DASH)

$
0
0

Hi all,
Using the ff.annotated heatmap in DASH.

Does anyone know how to make a custom colorscale so the negative numbers in their heatmap are Red and the positive ones are green? and maybe even put the numbers close to 0 at yellow?

Thank you

1 post - 1 participant

Read full topic

Prevent Callbacks When Adding Elements To Dash Layout

$
0
0

Hi, first question on this forum.

So I’m making a Dash App which includes the functionality to press a button to add a particular element to the app layout (let’s call it the “button element”). The issue I’m having is that when I press that button, every callback attached to something in the button element is fired, both for the button element I just created and for every button element I had previously created. So if I have 3 callbacks to something in the button element, then the 5th time I press the button, the app is running 15 callbacks at once.

How can I prevent all these callbacks from firing every time I create a button element? I can provide more details if necessary.

(Edit: note that I’m using pattern-matching callbacks for this)

Thanks!

2 posts - 2 participants

Read full topic

Updating data in dcc.Graph dash plotly

$
0
0

Hi.

This topic is for sharing with the community a custom dash component to update data from multiple traces in a dcc.Graph. This library is based on the " mydcc.Change_trace" code of https://github.com/jimmybow/mydcc repo and it was modified for multiple traces.

I published a dash example on my GitHub: update-trace-dash-plotly

You can install it with: pip install dash_update_data_components

I don’t know javascript, I just changed a little bit the code of jimmybow to full fit my expectations. I have not tried to change the x,y of a trace, just colour.

I hope this library helps you.

Example:
update-traces

1 post - 1 participant

Read full topic

Have action in a text block trigger a callback in a data graphic?

$
0
0

Suppose I have a markdown block or other text block, maybe with an anchor tag in it. Is it possible to have the user click on the text and then trigger a callback in a data visualization? Sometimes I have sentences or paragraphs that correspond to a particular view of the data visualization that I want people to see when they get to that part of the text description.

2 posts - 2 participants

Read full topic

Show and tell - A pokemon dashboard (with pokemon type prediction)

$
0
0

Hi all,
I built my first dash app called “Dash pokemon”. It is for visual analysis and pokemon type prediction and could be useful for pokemon related gaming.

app demo gif -
pokemon_demo_fast_Full HD 1080p

The app is currently live here - dash-pokemon

Check out the code here - github

The app has 4 tabs -

  • Tab 1 - Bar graph visual of best pokemon using Pokemon type and strength criteria.
  • Tab 2 - Box plot for each pokemon type. Also finds the best and worst types.
  • Tab 3 - Scatterplot, pairplot - Correlations between different features of pokemon.
  • Tab 4 - Predicting a Pokemon’s type using its features. There are options to play around with features as well as the targets (pokemon’s types) to be classified.
    Model accuracy varies according to the options selected.

I enjoyed using Plotly dash, and have learned a fair bit about how it works.
Looking forward to making more dashboards!

Here are some Screenshots -

tab 1 -

tab 2 -

tab 3 -

tab 4 -

1 post - 1 participant

Read full topic

Viewing all 6271 articles
Browse latest View live