Click event only generated when clicking in specific areas of Bar graph

Hi, There seems to be a problem with integration between panel and plotly when receiving click event upon clicking on the bar in the plotly graph. Usually the event is only triggered when clicking in the space between the bars and not inside the Bar. if sizing_mode is not used, situation gets even worse. Not sure it this is a bug or some missing configuration.

A similar code using dash and plotly works fine.

panel code:

# run as: panel serve --autoreload

import as px
import pandas as pd
import panel as pn

df = pd.DataFrame(data = {'month':['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec'],'value':[10,15,20,5,12,6,21,8,9,3,11,17]})['month'], y=df['value'])

def on_click(event):
    if == 'click_data':
        if event.obj is not None:
            print("on_click", event.obj.click_data)
            print("on_click old", event.old)
            print("on_click new",

plot_panel = pn.pane.Plotly(fig, 
                            config={"responsive": True},
                            ), ["click_data"],onlychanged=False)


dash code:

app = dash.Dash(__name__)

app.layout = dhtml.Div([
        style={'marginTop': '20px'},

    Output("where", "children"),
    Input("graph", "clickData"))
def display_click_data(clickData):
    return json.dumps(clickData, indent=2)

if __name__ == '__main__':
1 Like

Hi @fleite

Welcome to the community.

I can reproduce this issue. Please file this as a bug on Github. Thanks.

Hi @Marc thanks for the prompt reply.

Issue opened


1 Like